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

Bug 320127

Summary: [RCP] Null pointer exception when shutting down Eclipse based RCP:
Product: [Eclipse Project] Platform Reporter: Pawan Singh <psingh>
Component: UIAssignee: Platform UI Triaged <platform-ui-triaged>
Status: RESOLVED INVALID QA Contact: Prakash Rangaraj <prakash>
Severity: normal    
Priority: P3 CC: pwebster, remy.suen
Version: 3.5.2   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Pawan Singh CLA 2010-07-16 13:03:57 EDT
Build Identifier: M20100211-1343

Here is the exception stacktrace:

java.lang.NullPointerException
at org.eclipse.ui.internal.WorkbenchWindow.hardClose(WorkbenchWindow.java:1661)
at org.eclipse.ui.internal.WorkbenchWindow.busyClose(WorkbenchWindow.java:724)
at org.eclipse.ui.internal.WorkbenchWindow.access$0(WorkbenchWindow.java:700)
at org.eclipse.ui.internal.WorkbenchWindow$5.run(WorkbenchWindow.java:816)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
at org.eclipse.ui.internal.WorkbenchWindow.close(WorkbenchWindow.java:814)
at com.fnfr.svt.replay.Activator.closeEngineForNonMainWindow(Activator.java:378)
at com.fnfr.svt.rcp.ApplicationWorkbenchWindowAdvisor.preWindowShellClose(ApplicationWorkbenchWindowAdvisor.java:86)
at org.eclipse.ui.internal.WorkbenchWindow.fireWindowShellClosing(WorkbenchWindow.java:1334)
at org.eclipse.ui.internal.WorkbenchWindow.canHandleShellCloseEvent(WorkbenchWindow.java:806)
at org.eclipse.jface.window.Window$3.shellClosed(Window.java:686)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:92)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1027)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1012)
at org.eclipse.swt.widgets.Decorations.closeWidget(Decorations.java:308)
at org.eclipse.swt.widgets.Decorations.WM_CLOSE(Decorations.java:1645)
at org.eclipse.swt.widgets.Control.windowProc(Control.java:3948)
at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:342)
at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.java:1578)
at org.eclipse.swt.widgets.Shell.windowProc(Shell.java:2010)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:4619)
at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method)
at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:2406)
at org.eclipse.swt.widgets.Shell.callWindowProc(Shell.java:492)
at org.eclipse.swt.widgets.Control.windowProc(Control.java:4036)
at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:342)
at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.java:1578)
at org.eclipse.swt.widgets.Shell.windowProc(Shell.java:2010)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:4619)
at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method)
at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:2406)
at org.eclipse.swt.widgets.Shell.callWindowProc(Shell.java:492)
at org.eclipse.swt.widgets.Control.windowProc(Control.java:4036)
at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:342)
at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.java:1578)
at org.eclipse.swt.widgets.Shell.windowProc(Shell.java:2010)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:4619)
at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2411)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3501)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2405)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2369)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2221)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at com.fnfr.svt.rcp.Application.runWorkbench(Application.java:217)
at com.fnfr.svt.rcp.Application.start(Application.java:200)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194)
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:368)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
at org.eclipse.equinox.launcher.Main.run(Main.java:1311)


Reproducible: Sometimes

Steps to Reproduce:
1. Close Eclipse/RCP and restart it.
2. Sometimes you will see this error in the error log.
Comment 1 Remy Suen CLA 2010-07-16 13:11:16 EDT
(In reply to comment #0)
> Build Identifier: M20100211-1343

Does this happen on 3.6?

> 1. Close Eclipse/RCP and restart it.

The stack trace indicates that the workbench window is being closed. Is restarting actually relevant?
Comment 2 Prakash Rangaraj CLA 2010-07-29 04:30:59 EDT
(In reply to comment #1)
> (In reply to comment #0)
> > Build Identifier: M20100211-1343
> 
> Does this happen on 3.6?
> 
> > 1. Close Eclipse/RCP and restart it.
> 
> The stack trace indicates that the workbench window is being closed. Is
> restarting actually relevant?

Pawan,

   Can you answer the question?

Paul,

    Is WorkbenchWindowAdvisor.preWindowShellClose() calling WorkbenchWindow.close() a valid call?
Comment 3 Paul Webster CLA 2010-07-29 07:42:19 EDT
No, you cannot call WorkbenchWindow.close() from within the preWindowShellClose().  WorkbenchWindow.close() must close the window before it returns, and preWindowShellClose() must return true or false to a WorkbenchWindow that's still in the transition state (since false can prevent its closing).

PW
Comment 4 Pawan Singh CLA 2010-07-29 12:09:02 EDT
Thanks for the info guys. You can close this bug then as user error. We will fix our RCP code.