diff options
| author | Markus Keller | 2015-11-13 15:54:08 +0000 |
|---|---|---|
| committer | Markus Keller | 2015-11-23 16:38:55 +0000 |
| commit | b46c3bba33f1f1a321d905e61e273e87c71e8bc2 (patch) | |
| tree | b3c315c009182f8675df0074874266bb69e0a805 | |
| parent | 992c601a686dfc065c1fa02059b078e3c0194c43 (diff) | |
| download | eclipse.platform.ui-b46c3bba33f1f1a321d905e61e273e87c71e8bc2.tar.gz eclipse.platform.ui-b46c3bba33f1f1a321d905e61e273e87c71e8bc2.tar.xz eclipse.platform.ui-b46c3bba33f1f1a321d905e61e273e87c71e8bc2.zip | |
Bug 482162: [backports] Eclipse crashes with NPE on existing workspace (after closing window twice)
| -rw-r--r-- | bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java index ce56aedfcf2..f14cbf320d5 100644 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java +++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java @@ -1526,8 +1526,33 @@ public class WorkbenchWindow implements IWorkbenchWindow { * Assumes that busy cursor is active. */ private boolean busyClose(boolean remove) { - if (closing) + /* + * Warning: Intricate flow of control and re-entrant invocations of this + * method: + * + * - busyClose(true) is called from WorkbenchWindow#close() when the + * user closes a workbench window. + * + * - busyClose(false) is called from Workbench#close(int, boolean). This + * happens on File > Exit/Restart, [Mac] Quit Eclipse, AND ... tadaa ... + * from busyClose(true) when the user closes the last window => [Case A] + * + * Additional complication: busyClose(true) can also be called again + * when someone runs an event loop during the shutdown sequence. In that + * case, the nested busyClose(true) should be dropped (bug 381555) => + * [Case B] + */ + if (closing) { + // [Case A] Window is already closing. + return false; + } + if (updateDisabled && remove) { + // [Case B] User closed this window, which triggered + // "workbench.close()", during which the user tried to close this + // window again. return false; + } + // Whether the window was actually closed or not boolean windowClosed = false; |
