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

Bug 356540

Summary: NPE in VariablesView.partDeactivated caused by hiding a view in a partActivated listener
Product: [Eclipse Project] Platform Reporter: Francis Upton IV <francisu>
Component: UIAssignee: Platform-UI-Inbox <Platform-UI-Inbox>
Status: RESOLVED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: daniel_megert, psuzzi, remy.suen
Version: 3.6   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Francis Upton IV CLA 2011-09-01 23:28:28 EDT
I don't think I can reproduce this; the problem went away when I closed the debug perspective, but until then it happened every time I showed one of the views associated with my application.

eclipse.buildId=I20100608-0911
java.version=1.6.0_22
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Command-line arguments:  -os linux -ws gtk -arch x86_64


Error
Thu Sep 01 20:11:50 PDT 2011
Problems occurred when invoking code from plug-in: "org.eclipse.ui.workbench".

java.lang.NullPointerException
at org.eclipse.debug.internal.ui.views.variables.VariablesView.partDeactivated(VariablesView.java:612)
at org.eclipse.ui.part.PageBookView$4.partDeactivated(PageBookView.java:1022)
at org.eclipse.ui.internal.PartListenerList2$4.run(PartListenerList2.java:115)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.runtime.Platform.run(Platform.java:888)
at org.eclipse.ui.internal.PartListenerList2.fireEvent(PartListenerList2.java:55)
at org.eclipse.ui.internal.PartListenerList2.firePartDeactivated(PartListenerList2.java:113)
at org.eclipse.ui.internal.PartService.firePartDeactivated(PartService.java:242)
at org.eclipse.ui.internal.PartService.setActivePart(PartService.java:300)
at org.eclipse.ui.internal.WorkbenchPagePartList.fireActivePartChanged(WorkbenchPagePartList.java:57)
at org.eclipse.ui.internal.PartList.setActivePart(PartList.java:136)
at org.eclipse.ui.internal.WorkbenchPage.setActivePart(WorkbenchPage.java:3537)
at org.eclipse.ui.internal.WorkbenchPage.internalActivate(WorkbenchPage.java:617)
at org.eclipse.ui.internal.WorkbenchPage.activate(WorkbenchPage.java:589)
at com.oaklandsw.transform.editor.c.a(c.java:1555)
at com.oaklandsw.transform.editor.c$3.run(c$3.java:1642)
at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:179)
at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:150)
at org.eclipse.swt.widgets.Display.syncExec(Display.java:4294)
at com.oaklandsw.gui.k.b(k.java:1917)
at com.oaklandsw.transform.editor.c.setCurrentMainNode(c.java:1640)
at com.oaklandsw.transform.editor.c$6.run(c$6.java:2126)
at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:179)
at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:150)
at org.eclipse.swt.widgets.Display.syncExec(Display.java:4294)
at com.oaklandsw.gui.k.b(k.java:1917)
at com.oaklandsw.transform.editor.c.showNode(c.java:2165)
at com.oaklandsw.transform.editor.results.a$1$0.run(a$1$0.java:340)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3527)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3174)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2629)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2593)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2427)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:670)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:663)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
at org.eclipse.equinox.launcher.Main.main(Main.java:1383)
Comment 1 Francis Upton IV CLA 2011-09-01 23:43:59 EDT
I don't think this is Debug's problem; I can now make it happen at will and you are the victim of a part ref with a null part.

This seems to be a dup of bug 355456

*** This bug has been marked as a duplicate of bug 355456 ***
Comment 2 Francis Upton IV CLA 2011-09-02 00:06:50 EDT
For the record, I found out what's causing this problem. In one of my partActivated listeners I'm hiding a view, which causes trouble further down the invocation chain. When I moved the hiding of the view to an asyncExec, the problem went away.

Platform UI might want to have a look at this; I'm not sure what the rules are for hiding a view withing a partActivation event.
Comment 3 Dani Megert CLA 2011-09-02 02:18:28 EDT
(In reply to comment #2)
> For the record, I found out what's causing this problem. In one of my
> partActivated listeners I'm hiding a view, which causes trouble further down
> the invocation chain. When I moved the hiding of the view to an asyncExec, the
> problem went away.
> 
> Platform UI might want to have a look at this; I'm not sure what the rules are
> for hiding a view withing a partActivation event.

Can you provide a test plug-in / example?