Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Keller2015-11-13 15:54:08 +0000
committerMarkus Keller2015-11-23 19:33:49 +0000
commit09ffb223efb2ad9d256e36b6debc4efab6725bd4 (patch)
treeb8861196bbada92a2e9ad45e545cb191af9a24b4
parentc7c8d4edff8f7a7148ef468f73d2184ec215b665 (diff)
downloadeclipse.platform.ui-09ffb223efb2ad9d256e36b6debc4efab6725bd4.tar.gz
eclipse.platform.ui-09ffb223efb2ad9d256e36b6debc4efab6725bd4.tar.xz
eclipse.platform.ui-09ffb223efb2ad9d256e36b6debc4efab6725bd4.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.java27
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 4b4adbce41d..46c6086663d 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
@@ -1237,8 +1237,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;

Back to the top