diff options
| author | Markus Keller | 2015-11-13 15:54:08 +0000 |
|---|---|---|
| committer | Markus Keller | 2015-11-23 13:42:24 +0000 |
| commit | daaa20bcd06c8f1186b13482a1c54a0799dee883 (patch) | |
| tree | 3c3958a9b285561852ea51182bac42a2b08d0906 | |
| parent | d92eb560a5bab0aeec74d96ae5c635de1bbd0cff (diff) | |
| download | eclipse.platform.ui-daaa20bcd06c8f1186b13482a1c54a0799dee883.tar.gz eclipse.platform.ui-daaa20bcd06c8f1186b13482a1c54a0799dee883.tar.xz eclipse.platform.ui-daaa20bcd06c8f1186b13482a1c54a0799dee883.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 816b6e0f9c0..f3b4b3ec459 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 @@ -1540,8 +1540,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; |
