Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 318949

Summary: Invalid thread access in Import project wizard
Product: [Technology] EGit Reporter: Benjamin Muskalla <b.muskalla>
Component: UIAssignee: Project Inbox <egit.ui-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: mathias.kinzler
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Benjamin Muskalla CLA 2010-07-05 20:42:14 EDT
* clone empty repository
* Import projects..
* Next

This happens when we try to show an error message while running inside the job and not in the UI thread.

!ENTRY org.eclipse.egit.ui 4 0 2010-07-06 00:49:55.984
!MESSAGE 
!STACK 0
java.lang.reflect.InvocationTargetException
	at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:421)
	at org.eclipse.jface.wizard.WizardDialog.run(WizardDialog.java:1008)
	at org.eclipse.egit.ui.internal.clone.GitProjectsImportPage.setProjectsList(GitProjectsImportPage.java:321)
	at org.eclipse.egit.ui.internal.clone.GitCreateProjectViaWizardWizard$1.setVisible(GitCreateProjectViaWizardWizard.java:94)
	at org.eclipse.jface.wizard.WizardDialog.updateForPage(WizardDialog.java:1239)
	at org.eclipse.jface.wizard.WizardDialog.access$4(WizardDialog.java:1218)
	at org.eclipse.jface.wizard.WizardDialog$6.run(WizardDialog.java:1207)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
	at org.eclipse.jface.wizard.WizardDialog.showPage(WizardDialog.java:1205)
	at org.eclipse.jface.wizard.WizardDialog.nextPressed(WizardDialog.java:894)
	at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:426)
	at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:624)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:234)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3552)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3171)
	at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
	at org.eclipse.jface.window.Window.open(Window.java:801)
	at org.eclipse.egit.ui.internal.repository.tree.command.ImportProjectsCommand.execute(ImportProjectsCommand.java:45)
	at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:293)
	at org.eclipse.core.commands.Command.executeWithChecks(Command.java:476)
	at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
	at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:169)
	at org.eclipse.ui.internal.handlers.SlaveHandlerService.executeCommand(SlaveHandlerService.java:241)
	at org.eclipse.ui.internal.handlers.SlaveHandlerService.executeCommand(SlaveHandlerService.java:241)
	at org.eclipse.ui.menus.CommandContributionItem.handleWidgetSelection(CommandContributionItem.java:820)
	at org.eclipse.ui.menus.CommandContributionItem.access$19(CommandContributionItem.java:806)
	at org.eclipse.ui.menus.CommandContributionItem$5.handleEvent(CommandContributionItem.java:796)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3552)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3171)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2629)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2593)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2427)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:670)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:663)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1383)
Caused by: org.eclipse.swt.SWTException: Invalid thread access
	at org.eclipse.swt.SWT.error(SWT.java:4083)
	at org.eclipse.swt.SWT.error(SWT.java:3998)
	at org.eclipse.swt.SWT.error(SWT.java:3969)
	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.setText(Text.java:2031)
	at org.eclipse.jface.dialogs.TitleAreaDialog.updateMessage(TitleAreaDialog.java:612)
	at org.eclipse.jface.dialogs.TitleAreaDialog.setErrorMessage(TitleAreaDialog.java:409)
	at org.eclipse.jface.wizard.WizardDialog.updateMessage(WizardDialog.java:1372)
	at org.eclipse.jface.wizard.WizardPage.setErrorMessage(WizardPage.java:257)
	at org.eclipse.egit.ui.internal.clone.GitProjectsImportPage$7.run(GitProjectsImportPage.java:349)
	at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
Root exception:
org.eclipse.swt.SWTException: Invalid thread access
	at org.eclipse.swt.SWT.error(SWT.java:4083)
	at org.eclipse.swt.SWT.error(SWT.java:3998)
	at org.eclipse.swt.SWT.error(SWT.java:3969)
	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.setText(Text.java:2031)
	at org.eclipse.jface.dialogs.TitleAreaDialog.updateMessage(TitleAreaDialog.java:612)
	at org.eclipse.jface.dialogs.TitleAreaDialog.setErrorMessage(TitleAreaDialog.java:409)
	at org.eclipse.jface.wizard.WizardDialog.updateMessage(WizardDialog.java:1372)
	at org.eclipse.jface.wizard.WizardPage.setErrorMessage(WizardPage.java:257)
	at org.eclipse.egit.ui.internal.clone.GitProjectsImportPage$7.run(GitProjectsImportPage.java:349)
	at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
Comment 1 Mathias Kinzler CLA 2010-07-09 06:25:02 EDT
How can I reproduce this? Is this happening during some UI tests? I tried to reproduce this by forcing the offending call to setErrorMessage every time when the page is opened, but couldn't see the problem in the normal UI.
Comment 2 Benjamin Muskalla CLA 2010-07-09 07:37:33 EDT
Happens to me when running GitRepositoriesViewTest#testImportWizard and can reproduce manually with the steps above:

* create empty repository with git init
* clone the repo
* Right click > Import Projects...
* Import Existing and Try to share automatically
* Next

Only happens the first time when clicking next. Going back and forth again, the exception does not occur and the error message is shown.
Comment 3 Mathias Kinzler CLA 2010-07-09 08:33:11 EDT
(In reply to comment #2)
> Happens to me when running GitRepositoriesViewTest#testImportWizard and can
> reproduce manually with the steps above:
> 
> * create empty repository with git init
> * clone the repo
> * Right click > Import Projects...
> * Import Existing and Try to share automatically
> * Next
> 
> Only happens the first time when clicking next. Going back and forth again, the
> exception does not occur and the error message is shown.

Thanks, now I got it.
Code review at
http://egit.eclipse.org/r/#change,1090
Comment 4 Mathias Kinzler CLA 2010-07-20 09:30:47 EDT
Merged as 22b1d4d478f200c8348109991a457148f07b98cc