diff options
author | Simeon Andreev | 2018-06-05 09:58:08 +0000 |
---|---|---|
committer | Andrey Loskutov | 2018-06-08 04:48:02 +0000 |
commit | abce592a8af295a655b82b9986333ef2135c64bd (patch) | |
tree | e2cdb53a65c8710a8203aee814e7dbedac433239 /org.eclipse.debug.ui/ui | |
parent | 28ea7b34c5db19803898f984c8c81472d2f1b026 (diff) | |
download | eclipse.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>
Diffstat (limited to 'org.eclipse.debug.ui/ui')
-rw-r--r-- | org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupFacility.java | 19 |
1 files changed, 18 insertions, 1 deletions
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) */ |