Bug 355299 - "invalid thread access" dialog when attempting to search C/C++ project for references
Summary: "invalid thread access" dialog when attempting to search C/C++ project for re...
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-source-nav (show other bugs)
Version: 7.0.2   Edit
Hardware: PC Windows XP
: P3 major with 1 vote (vote)
Target Milestone: 8.6.0   Edit
Assignee: Markus Schorn CLA
QA Contact: Markus Schorn CLA
URL:
Whiteboard:
Keywords:
: 443260 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-08-20 15:18 EDT by Kirk Beitz CLA
Modified: 2014-09-04 00:30 EDT (History)
7 users (show)

See Also:


Attachments
Event Details for 'An internal error occurred during: "Search References".' (1.92 KB, text/plain)
2011-08-20 15:18 EDT, Kirk Beitz CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kirk Beitz CLA 2011-08-20 15:18:58 EDT
Created attachment 201859 [details]
Event Details for 'An internal error occurred during: "Search References".'

using either F4 or ctrl-H search targeted for a C/C++ project, and searching for any lexical element, or for a targeted element known to be a function/method and confined to a smaller working-set, attempting to perform the search results in a dialog:


 +---------------------------------------------------------+
 |Problem Occurred
 +---------------------------------------------------------+
 |X 'Search references' has encountered a problem.
 |
 |   An internal error occurred during: "Search
 |   references".
 |
 |                                     OK     << Details   |
 |+-------------------------------------------------------+|
 ||An internal error occurred during: "Search references".||
 || Invalid thread access
 |+-------------------------------------------------------+|
 +---------------------------------------------------------+
Comment 1 Roy Paterson CLA 2011-10-14 11:43:04 EDT
Our customers are seeing this problem too.  Looks like the CDT search is looking for dirty editors but it's not using the UI thread.

Here's the relevant log:

!ENTRY org.eclipse.core.jobs 4 2 2011-10-13 16:45:07.011
!MESSAGE An internal error occurred during: "Search references".
!STACK 0
org.eclipse.swt.SWTException: Invalid thread access
    at org.eclipse.swt.SWT.error(SWT.java:4282)
    at org.eclipse.swt.SWT.error(SWT.java:4197)
    at org.eclipse.swt.SWT.error(SWT.java:4168)
    at org.eclipse.swt.widgets.Widget.error(Widget.java:466)
    at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:404)
    at org.eclipse.swt.widgets.Text.getTextChars(Text.java:1064)
    at org.eclipse.swt.widgets.Text.getText(Text.java:1008)
    at
com.smartbear.collaborator.ui.review.GeneralInfoWidget.titleDirty(GeneralInfoWidget.java:558)
    at
com.smartbear.collaborator.ui.review.GeneralInfoWidget.isDirty(GeneralInfoWidget.java:521)
    at
com.smartbear.collaborator.ui.editors.ReviewEditor.isDirty(ReviewEditor.java:188)
    at
org.eclipse.ui.internal.EditorManager.collectDirtyEditors(EditorManager.java:294)
    at
org.eclipse.ui.internal.EditorManager.getDirtyEditors(EditorManager.java:587)
    at
org.eclipse.ui.internal.WorkbenchPage.getDirtyEditors(WorkbenchPage.java:2153)
    at org.eclipse.cdt.ui.CUIPlugin.getDirtyEditors(CUIPlugin.java:760)
    at
org.eclipse.cdt.internal.ui.search.PDOMSearchQuery.collectNames(PDOMSearchQuery.java:281)
    at
org.eclipse.cdt.internal.ui.search.PDOMSearchQuery.createMatches(PDOMSearchQuery.java:372)
    at
org.eclipse.cdt.internal.ui.search.PDOMSearchQuery.createMatches(PDOMSearchQuery.java:328)
    at
org.eclipse.cdt.internal.ui.search.PDOMSearchTextSelectionQuery$1.runOnAST(PDOMSearchTextSelectionQuery.java:78)
    at
org.eclipse.cdt.internal.core.model.ASTCache.runOnAST(ASTCache.java:223)
    at
org.eclipse.cdt.internal.ui.editor.ASTProvider.runOnAST(ASTProvider.java:347)
    at
org.eclipse.cdt.internal.ui.search.PDOMSearchTextSelectionQuery.runWithIndex(PDOMSearchTextSelectionQuery.java:55)
    at
org.eclipse.cdt.internal.ui.search.PDOMSearchQuery.run(PDOMSearchQuery.java:498)
    at
org.eclipse.search2.internal.ui.InternalSearchUI$InternalSearchJob.run(InternalSearchUI.java:91)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Comment 2 Roy Paterson CLA 2011-10-14 11:54:13 EDT
(Smart Bear Case 59749)
Comment 3 Anton Leherbauer CLA 2013-07-02 05:30:00 EDT
This is a pretty severe issue. It happens whenever an editor is open which needs to access an SWT control to check its dirty state.  This is true for many FormEditors, like the Plugin Manifest Editor.  This is why I just ran into this.
Comment 4 Anton Leherbauer CLA 2013-07-02 05:44:09 EDT
CQ:WIND00415435
Comment 5 Marc-André Laperle CLA 2014-06-15 10:17:01 EDT
Still happens in CDT 8.4.0.201406111759

1. Open a PDE editor with forms (plugin.xml)
2. Open a C/C++ source file with some variables
3. Search for references (Ctrl-shift-G)

org.eclipse.swt.SWTException: Invalid thread access
	at org.eclipse.swt.SWT.error(SWT.java:4441)
	at org.eclipse.swt.SWT.error(SWT.java:4356)
	at org.eclipse.swt.SWT.error(SWT.java:4327)
	at org.eclipse.swt.widgets.Widget.error(Widget.java:476)
	at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:414)
	at org.eclipse.swt.widgets.Widget.getData(Widget.java:502)
	at org.eclipse.ui.forms.DetailsPart.getCurrentPage(DetailsPart.java:135)
	at org.eclipse.ui.forms.DetailsPart.isDirty(DetailsPart.java:165)
	at org.eclipse.ui.forms.ManagedForm.isDirty(ManagedForm.java:272)
	at org.eclipse.ui.forms.editor.FormPage.isDirty(FormPage.java:231)
	at org.eclipse.ui.forms.editor.FormEditor.isDirty(FormEditor.java:265)
	at org.eclipse.pde.internal.ui.editor.PDEFormEditor.computeDirtyState(PDEFormEditor.java:615)
	at org.eclipse.pde.internal.ui.editor.PDEFormEditor.isDirty(PDEFormEditor.java:607)
	at org.eclipse.ui.internal.WorkbenchPage.getDirtyEditors(WorkbenchPage.java:2247)
	at org.eclipse.cdt.ui.CUIPlugin.getDirtyEditors(CUIPlugin.java:807)
	at org.eclipse.cdt.internal.ui.search.CSearchQuery.createLocalMatches(CSearchQuery.java:462)
	at org.eclipse.cdt.internal.ui.search.CSearchTextSelectionQuery$1.runOnAST(CSearchTextSelectionQuery.java:71)
	at org.eclipse.cdt.internal.core.model.ASTCache.runOnAST(ASTCache.java:219)
	at org.eclipse.cdt.internal.ui.editor.ASTProvider.runOnAST(ASTProvider.java:377)
	at org.eclipse.cdt.internal.ui.search.CSearchTextSelectionQuery.runWithIndex(CSearchTextSelectionQuery.java:55)
	at org.eclipse.cdt.internal.ui.search.CSearchQuery.run(CSearchQuery.java:522)
	at org.eclipse.search2.internal.ui.InternalSearchUI$InternalSearchJob.run(InternalSearchUI.java:91)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Comment 6 Markus Schorn CLA 2014-08-29 02:28:56 EDT
The text search does a similar check on dirty editors, however it ignores all non text editors. We can do the same for CDT.
Comment 7 Markus Schorn CLA 2014-08-29 03:31:48 EDT
Fixed in master.
Comment 8 CDT Genie CLA 2014-08-30 01:00:11 EDT
*** cdt git genie on behalf of Markus Schorn ***

    Bug 355299: When looking for dirty editors during search: Only consider text editors

[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=e7cbbb7412d068811ed198c995e73ba0b646b430
Comment 9 Markus Schorn CLA 2014-09-04 00:30:24 EDT
*** Bug 443260 has been marked as a duplicate of this bug. ***