diff options
| author | Markus Keller | 2015-11-13 15:54:08 +0000 |
|---|---|---|
| committer | Markus Keller | 2015-11-20 19:29:09 +0000 |
| commit | 7edf74a51a1f56d4aa08e5bba9fe8658822cc51c (patch) | |
| tree | 28eef5690762676b0c6121ce5e2c8e86d80d47ae | |
| parent | 0673246d3494b34d8289b0c0b5b8325b1e581a8c (diff) | |
| download | eclipse.platform.ui-7edf74a51a1f56d4aa08e5bba9fe8658822cc51c.tar.gz eclipse.platform.ui-7edf74a51a1f56d4aa08e5bba9fe8658822cc51c.tar.xz eclipse.platform.ui-7edf74a51a1f56d4aa08e5bba9fe8658822cc51c.zip | |
Bug 482162: [Model] Eclipse crashes with NPE on existing workspace (after closing window twice)mkeller/Bug_482162_R4_2_maintenance
| -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 5021df11ca9..0c8020540b4 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 @@ -1203,8 +1203,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; |
