Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 344842 - [disassembly] NPE when shutting down the workbench
Summary: [disassembly] NPE when shutting down the workbench
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-debug-dsf (show other bugs)
Version: 8.0   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 8.0   Edit
Assignee: Patrick Chuong CLA
QA Contact: Pawel Piech CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-05 10:03 EDT by Patrick Chuong CLA
Modified: 2011-05-06 10:38 EDT (History)
2 users (show)

See Also:


Attachments
patch (1.10 KB, patch)
2011-05-06 09:59 EDT, Patrick Chuong CLA
pchuong: iplog-
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick Chuong CLA 2011-05-05 10:03:41 EDT
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
Comment 1 Anton Leherbauer CLA 2011-05-05 10:12:22 EDT
At first look, I would insert

   fUpdateCount++;

at the top of dispose().  That's probably a more general fix.
Comment 2 Patrick Chuong CLA 2011-05-05 10:35:57 EDT
Hmmm.. I am not sure what fUpdateCount++ does, but inserting it at the top of dispose() doesn't help.
Comment 3 Anton Leherbauer CLA 2011-05-06 01:45:54 EDT
I see.  Additionally test for fViewer == null at the beginning of startUpdate().  That should do it.
Comment 4 Patrick Chuong CLA 2011-05-06 09:59:41 EDT
Created attachment 194935 [details]
patch

Thanks Toni.
Comment 5 Patrick Chuong CLA 2011-05-06 10:01:54 EDT
Committed to HEAD.
Comment 6 CDT Genie CLA 2011-05-06 10:38:08 EDT
*** 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