Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimeon Andreev2018-06-05 09:58:08 +0000
committerAndrey Loskutov2018-06-08 04:48:02 +0000
commitabce592a8af295a655b82b9986333ef2135c64bd (patch)
treee2cdb53a65c8710a8203aee814e7dbedac433239
parent28ea7b34c5db19803898f984c8c81472d2f1b026 (diff)
downloadeclipse.platform.debug-abce592a8af295a655b82b9986333ef2135c64bd.tar.gz
eclipse.platform.debug-abce592a8af295a655b82b9986333ef2135c64bd.tar.xz
eclipse.platform.debug-abce592a8af295a655b82b9986333ef2135c64bd.zip
Bug 535462 - NPE when closing second window during debug
The bug occurs while debugging, having two windows and a custom debug context provider. When closing the second window, DebugWindowContextService.notify is called with the selection of the custom debug context provider. If this selection is e.g. a stack frame, SourceLookupService asks SourceLookupFacility to open a source file. This throws a NPE, since the workbench page window is closing. With this change SourceLookupFacility checks if the active workbench window is closing. If so, the source is not opened, avoiding the NPE. Note: updated platform.ui version range to see re-export updated ui.workbench API. Change-Id: Ifb177c1211248b0cda17c6d14201a210d5fec8dc Signed-off-by: Simeon Andreev <simeon.danailov.andreev@gmail.com> Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
-rw-r--r--org.eclipse.debug.ui/META-INF/MANIFEST.MF2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupFacility.java19
2 files changed, 19 insertions, 2 deletions
diff --git a/org.eclipse.debug.ui/META-INF/MANIFEST.MF b/org.eclipse.debug.ui/META-INF/MANIFEST.MF
index 5da91bae5..d0b52d626 100644
--- a/org.eclipse.debug.ui/META-INF/MANIFEST.MF
+++ b/org.eclipse.debug.ui/META-INF/MANIFEST.MF
@@ -78,7 +78,7 @@ Export-Package: org.eclipse.debug.internal.ui;
org.eclipse.debug.ui.stringsubstitution
Require-Bundle: org.eclipse.core.expressions;bundle-version="[3.4.0,4.0.0)",
org.eclipse.core.variables;bundle-version="[3.2.800,4.0.0)",
- org.eclipse.ui;bundle-version="[3.5.0,4.0.0)",
+ org.eclipse.ui;bundle-version="[3.110.0,4.0.0)",
org.eclipse.ui.console;bundle-version="[3.5.300,4.0.0)",
org.eclipse.help;bundle-version="[3.4.0,4.0.0)",
org.eclipse.debug.core;bundle-version="[3.9.0,4.0.0)";visibility:=reexport,
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupFacility.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupFacility.java
index da64c41f2..8d4a715cb 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupFacility.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupFacility.java
@@ -66,6 +66,7 @@ import org.eclipse.ui.IReusableEditor;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchPartReference;
+import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.progress.UIJob;
import org.eclipse.ui.texteditor.IDocumentProvider;
@@ -554,7 +555,7 @@ public class SourceLookupFacility implements IPageListener, IPartListener2, IPro
Runnable r = new Runnable() {
@Override
public void run() {
- if (!page.getWorkbenchWindow().getWorkbench().isClosing()) {
+ if (!isClosing(page)) {
try {
editor[0] = page.openEditor(input, id, false, IWorkbenchPage.MATCH_ID|IWorkbenchPage.MATCH_INPUT);
} catch (PartInitException e) {
@@ -570,6 +571,22 @@ public class SourceLookupFacility implements IPageListener, IPartListener2, IPro
return editor[0];
}
+ private boolean isClosing(final IWorkbenchPage page) {
+ IWorkbenchWindow pageWindow = page.getWorkbenchWindow();
+
+ boolean isWorkbenchClosing = pageWindow.getWorkbench().isClosing();
+ if (isWorkbenchClosing) {
+ return true;
+ }
+
+ boolean isWorkbenchPageWindowClosing = pageWindow.isClosing();
+ if (isWorkbenchPageWindowClosing) {
+ return true;
+ }
+
+ return false;
+ }
+
/* (non-Javadoc)
* @see org.eclipse.ui.IPageListener#pageActivated(org.eclipse.ui.IWorkbenchPage)
*/

Back to the top