Project: Eclipse_Platform_UI
Bug 95658 [Workbench] Events are being dispatched and async/syncExecs are run before the Workbench is in a good state
Reported: 2005-05-17 16:45:11 | Status: verified fixed

As part of plug-in startup and activation, anyone can call Display.readAndDispatch() to process UI events. This will also run any outstanding asyncExecs and syncExecs. For example, ModalContext.ModalContextThread#block calls readAndDispatch. This in turn is indirectly called by ProgressManager#run, which is called by CVS's AllRootsElement when the repositories view is created. The code that restores the Workbench is written in a way that it assumes no events are dispatched and no async/syncExecs are run before the 'real' UI event loop runs. This is a false assumption. I am attaching source for a modified UISynchronizer that delays at least the async/syncExecs until it is safe to run them. However, this creates a new problem in that ModalContext.ModalContextThread#block actually blocks forever because the syncExec in ModalContext.ModalContextThread#run is not being executed. We should either be prepared for anyone to call into Workbench methods even before we run the event loop, or use something along the lines of the attached UISycnhronizer to prevent this from happening.

Files changed in fix:
bundles/org.eclipse.jface/src/org/eclipse/jface/operation/ModalContext.java bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Workbench.java bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressManager.java