Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 415625

Summary: NPE in getViewStack() breaks key bindings F5 - F8
Product: [Eclipse Project] Platform Reporter: Stephan Herrmann <stephan.herrmann>
Component: UIAssignee: Eric Moffatt <emoffatt>
Status: CLOSED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: dreyer.ray, emoffatt, Michael_Rennie, pwebster
Version: 4.3   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Stephan Herrmann CLA 2013-08-21 14:47:22 EDT
I'm seeing the exception pasted below, which is logged at the moment when a debug session hits its first breakpoint.

When this happens the debug keys F5-F8 no longer work (F11 e.g. is uneffected). Guessing that F5-F8 don't work because they can't find the debug context, I assume the exception would indeed be the cause.

Resetting the debug perspective fixed the issue. Trying to restore my previous state did not bring back the bug.

If it happens again, I will report my perspective layout.


java.lang.NullPointerException
	at org.eclipse.ui.internal.WorkbenchPage.getViewStack(WorkbenchPage.java:4317)
	at org.eclipse.debug.internal.ui.views.ViewContextService$ViewBinding.checkZOrder(ViewContextService.java:517)
	at org.eclipse.debug.internal.ui.views.ViewContextService$DebugContextViewBindings.doActivation(ViewContextService.java:264)
	at org.eclipse.debug.internal.ui.views.ViewContextService$DebugContextViewBindings.activateChain(ViewContextService.java:235)
	at org.eclipse.debug.internal.ui.views.ViewContextService.activateChain(ViewContextService.java:1011)
	at org.eclipse.debug.internal.ui.views.ViewContextService.contextActivated(ViewContextService.java:838)
	at org.eclipse.debug.internal.ui.views.ViewContextService.contextManagerChanged(ViewContextService.java:1085)
	at org.eclipse.core.commands.contexts.ContextManager.fireContextManagerChanged(ContextManager.java:165)
	at org.eclipse.core.commands.contexts.ContextManager.setActiveContextIds(ContextManager.java:295)
	at org.eclipse.e4.ui.internal.services.ContextContextService.getActiveContextIds(ContextContextService.java:179)
	at org.eclipse.ui.internal.contexts.ContextService.getActiveContextIds(ContextService.java:270)
	at org.eclipse.ui.internal.contexts.ActiveContextSourceProvider.getCurrentState(ActiveContextSourceProvider.java:68)
	at org.eclipse.ui.internal.contexts.ActiveContextSourceProvider.contextManagerChanged(ActiveContextSourceProvider.java:50)
	at org.eclipse.core.commands.contexts.ContextManager.fireContextManagerChanged(ContextManager.java:165)
	at org.eclipse.core.commands.contexts.ContextManager.addActiveContext(ContextManager.java:109)
	at org.eclipse.ui.internal.contexts.ContextAuthority.updateContext(ContextAuthority.java:756)
	at org.eclipse.ui.internal.contexts.ContextAuthority.activateContext(ContextAuthority.java:173)
	at org.eclipse.ui.internal.contexts.ContextService.activateContext(ContextService.java:171)
	at org.eclipse.ui.internal.contexts.ContextService.activateContext(ContextService.java:101)
	at org.eclipse.debug.internal.ui.contexts.DebugModelContextBindingManager.activateContext(DebugModelContextBindingManager.java:269)
	at org.eclipse.debug.internal.ui.contexts.DebugModelContextBindingManager.activateModel(DebugModelContextBindingManager.java:256)
	at org.eclipse.debug.internal.ui.contexts.DebugModelContextBindingManager.activated(DebugModelContextBindingManager.java:227)
	at org.eclipse.debug.internal.ui.contexts.DebugModelContextBindingManager.debugContextChanged(DebugModelContextBindingManager.java:190)
	at org.eclipse.debug.internal.ui.contexts.DebugWindowContextService$1.run(DebugWindowContextService.java:211)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.debug.internal.ui.contexts.DebugWindowContextService.notify(DebugWindowContextService.java:209)
	at org.eclipse.debug.internal.ui.contexts.DebugWindowContextService.notify(DebugWindowContextService.java:184)
	at org.eclipse.debug.internal.ui.contexts.DebugWindowContextService.debugContextChanged(DebugWindowContextService.java:407)
	at org.eclipse.debug.ui.contexts.AbstractDebugContextProvider$1.run(AbstractDebugContextProvider.java:79)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.debug.ui.contexts.AbstractDebugContextProvider.fire(AbstractDebugContextProvider.java:77)
	at org.eclipse.debug.internal.ui.views.launch.LaunchView$ContextProviderProxy.debugContextChanged(LaunchView.java:506)
	at org.eclipse.debug.ui.contexts.AbstractDebugContextProvider$1.run(AbstractDebugContextProvider.java:79)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.debug.ui.contexts.AbstractDebugContextProvider.fire(AbstractDebugContextProvider.java:77)
	at org.eclipse.debug.internal.ui.views.launch.LaunchView$TreeViewerContextProvider.activate(LaunchView.java:371)
	at org.eclipse.debug.internal.ui.views.launch.LaunchView$1.selectionChanged(LaunchView.java:468)
	at org.eclipse.jface.viewers.Viewer$2.run(Viewer.java:164)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:49)
	at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)
	at org.eclipse.jface.viewers.Viewer.fireSelectionChanged(Viewer.java:162)
	at org.eclipse.jface.viewers.StructuredViewer.updateSelection(StructuredViewer.java:2188)
	at org.eclipse.jface.viewers.StructuredViewer.setSelection(StructuredViewer.java:1725)
	at org.eclipse.jface.viewers.TreeViewer.setSelection(TreeViewer.java:1139)
	at org.eclipse.debug.internal.ui.viewers.model.InternalTreeModelViewer.trySelection(InternalTreeModelViewer.java:1048)
	at org.eclipse.debug.internal.ui.viewers.model.TreeModelContentProvider.handleSelect(TreeModelContentProvider.java:1539)
	at org.eclipse.debug.internal.ui.viewers.model.TreeModelContentProvider.updateNodes(TreeModelContentProvider.java:1169)
	at org.eclipse.debug.internal.ui.viewers.model.TreeModelContentProvider.updateNodes(TreeModelContentProvider.java:1174)
	at org.eclipse.debug.internal.ui.viewers.model.TreeModelContentProvider.updateNodes(TreeModelContentProvider.java:1174)
	at org.eclipse.debug.internal.ui.viewers.model.TreeModelContentProvider.updateNodes(TreeModelContentProvider.java:1174)
	at org.eclipse.debug.internal.ui.viewers.model.TreeModelContentProvider.updateNodes(TreeModelContentProvider.java:1174)
	at org.eclipse.debug.internal.ui.viewers.model.TreeModelContentProvider.updateModel(TreeModelContentProvider.java:435)
	at org.eclipse.debug.internal.ui.viewers.model.TreeModelContentProvider.doModelChanged(TreeModelContentProvider.java:405)
	at org.eclipse.debug.internal.ui.viewers.model.TreeModelContentProvider.access$0(TreeModelContentProvider.java:399)
	at org.eclipse.debug.internal.ui.viewers.model.TreeModelContentProvider$2.run(TreeModelContentProvider.java:387)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
Comment 1 Stephan Herrmann CLA 2013-08-21 14:48:45 EDT
Happened in an SDK 4.3 plus EGit and some Mylyn.
Comment 2 Stephan Herrmann CLA 2013-09-01 05:48:18 EDT
Happened again, so this is my current perspective layout:

4 visible stacks:

+-------+---+
|   A   | C |
+-------+   |
|   B   +---+
|       | D |
+-------+---+

A = Debug / Type Hierarchy / Console
B = Editors
C = Variables / Breakpoints
D = Display

Minimized stacks:
Left:
E = Call Hierarchy (multiple) / Search / History
F = JUnit
Right:
G = Outline

I was debugging a test, so potentially all these received events for activation:
- Debug / Console / JUnit

Same symptoms: exception logged plus loss of F-key bindings.
When activated, JUnit overlaps most of stack A and expands slightly over B, too.

Today I was using 4.3.1 RC2, aka M20130829-1300.
Comment 3 Stephan Herrmann CLA 2013-09-01 06:05:10 EDT
This time after "reset perspective" I ran into what looks like bug 398186.

FWIW: I'm using the Classic theme.
Comment 4 Michael Rennie CLA 2013-09-03 09:53:06 EDT
moving to Platform UI form comment. Debug is checking for nulls while using the page API, and the exception is coming from WorkbenchPage.

For example the Debug code just prior to the exception does the following:

IViewPart part = page.findView(getViewId());
if (part != null) {
  IViewPart[] viewStack = page.getViewStack(part);
  if (viewStack != null && viewStack.length > 0) {
    ..
  }
}

The code in platform UI looks a bit suspicious:

MPart siblingPart = child instanceof MPart ? (MPart) child							: (MPart) ((MPlaceholder) child).getRef();
Object siblingObject = siblingPart.getObject();
Comment 5 Michael Rennie CLA 2013-09-06 11:21:28 EDT
*** Bug 416685 has been marked as a duplicate of this bug. ***
Comment 6 Michael Rennie CLA 2013-09-13 09:57:03 EDT

*** This bug has been marked as a duplicate of bug 398433 ***