Community
Participate
Working Groups
I can reproduce this NPE using TI debugger, and I have two cores running in one debug session. While the debug session is running with the disassembly view open, closing the workbench window without first terminating the debug session causes the NPE. A simple solution would be to check if fDocument != null before performing the rest of the stuff inside resetViewer(). Is this the right thing to do? Here is the stackframe: Thread [main] (Suspended (exception NullPointerException)) owns: RunnableLock (id=130) DisassemblyView(DisassemblyPart).setFocusPosition(Position) line: 2310 DisassemblyView(DisassemblyPart).resetViewer() line: 2033 DisassemblyView(DisassemblyPart).debugContextChanged() line: 1923 DisassemblyPart.access$17(DisassemblyPart) line: 1918 DisassemblyPart$19$1.run() line: 2965 DisassemblyPart$11.run() line: 1897 SafeRunner.run(ISafeRunnable) line: 42 DisassemblyView(DisassemblyPart).startUpdate(Runnable) line: 1914 DisassemblyPart.access$33(DisassemblyPart, Runnable) line: 1892 DisassemblyPart$19.run() line: 2963 RunnableLock.run() line: 35 UISynchronizer(Synchronizer).runAsyncMessages(boolean) line: 134 Display.runAsyncMessages(boolean) line: 4101 Display.readAndDispatch() line: 3718 ModalContext$ModalContextThread.block() line: 173 ModalContext.run(IRunnableWithProgress, boolean, IProgressMonitor, Display) line: 388 IDEWorkbenchAdvisor$CancelableProgressMonitorJobsDialog(ProgressMonitorDialog).run(boolean, boolean, IRunnableWithProgress) line: 507 IDEWorkbenchAdvisor$CancelableProgressMonitorJobsDialog(ProgressMonitorJobsDialog).run(boolean, boolean, IRunnableWithProgress) line: 275 IDEWorkbenchAdvisor.disconnectFromWorkspace() line: 515 IDEWorkbenchAdvisor.postShutdown() line: 348 Workbench.shutdown() line: 3023 Workbench.busyClose(boolean) line: 1118 Workbench.access$15(Workbench, boolean) line: 1035 Workbench$25.run() line: 1279 BusyIndicator.showWhile(Display, Runnable) line: 70 Workbench.close(int, boolean) line: 1277 Workbench.close() line: 1249 WorkbenchWindow.busyClose() line: 727 WorkbenchWindow.access$0(WorkbenchWindow) line: 715 WorkbenchWindow$5.run() line: 860 BusyIndicator.showWhile(Display, Runnable) line: 70 WorkbenchWindow.close() line: 858 WorkbenchWindow(Window).handleShellCloseEvent() line: 741 Window$3.shellClosed(ShellEvent) line: 687 TypedListener.handleEvent(Event) line: 98 EventTable.sendEvent(Event) line: 84 Shell(Widget).sendEvent(Event) line: 1053 Shell(Widget).sendEvent(int, Event, boolean) line: 1077 Shell(Widget).sendEvent(int, Event) line: 1062 Shell(Decorations).closeWidget() line: 308 Shell(Decorations).WM_CLOSE(int, int) line: 1677 Shell(Control).windowProc(int, int, int, int) line: 4509 Shell(Canvas).windowProc(int, int, int, int) line: 341 Shell(Decorations).windowProc(int, int, int, int) line: 1610 Shell.windowProc(int, int, int, int) line: 2061 Display.windowProc(int, int, int, int) line: 4933 OS.DefWindowProcW(int, int, int, int) line: not available [native method] OS.DefWindowProc(int, int, int, int) line: 2518 Shell.callWindowProc(int, int, int, int) line: 497 Shell(Control).windowProc(int, int, int, int) line: 4601 Shell(Canvas).windowProc(int, int, int, int) line: 341 Shell(Decorations).windowProc(int, int, int, int) line: 1610 Shell.windowProc(int, int, int, int) line: 2061 Display.windowProc(int, int, int, int) line: 4933 OS.DefWindowProcW(int, int, int, int) line: not available [native method] OS.DefWindowProc(int, int, int, int) line: 2518 Shell.callWindowProc(int, int, int, int) line: 497 Shell(Control).windowProc(int, int, int, int) line: 4601 Shell(Canvas).windowProc(int, int, int, int) line: 341 Shell(Decorations).windowProc(int, int, int, int) line: 1610 Shell.windowProc(int, int, int, int) line: 2061 Display.windowProc(int, int, int, int) line: 4933 OS.DispatchMessageW(MSG) line: not available [native method] OS.DispatchMessage(MSG) line: 2523 Display.readAndDispatch() line: 3713 Workbench.runEventLoop(Window$IExceptionHandler, Display) line: 2696 Workbench.runUI() line: 2660 Workbench.access$4(Workbench) line: 2494 Workbench$7.run() line: 674 Realm.runWithDefault(Realm, Runnable) line: 332 Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 667 PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 149 CCSWorkbench(IDEApplication).start(IApplicationContext) line: 123 EclipseAppHandle.run(Object) line: 196 EclipseAppLauncher.runApplication(Object) line: 110 EclipseAppLauncher.start(Object) line: 79 EclipseStarter.run(Object) line: 344 EclipseStarter.run(String[], Runnable) line: 179 NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method] NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39 DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25 Method.invoke(Object, Object...) line: 592 Main.invokeFramework(String[], URL[]) line: 622 Main.basicRun(String[]) line: 577 Main.run(String[]) line: 1410 Main.main(String[]) line: 1386
At first look, I would insert fUpdateCount++; at the top of dispose(). That's probably a more general fix.
Hmmm.. I am not sure what fUpdateCount++ does, but inserting it at the top of dispose() doesn't help.
I see. Additionally test for fViewer == null at the beginning of startUpdate(). That should do it.
Created attachment 194935 [details] patch Thanks Toni.
Committed to HEAD.
*** cdt cvs genie on behalf of pchuong *** Bug 344842 - [disassembly] NPE when shutting down the workbench [*] DisassemblyPart.java 1.49 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyPart.java?root=Tools_Project&r1=1.48&r2=1.49