Bug 409006 - [visualizer] NPE when closing visualizer with nothing selected in debug view
Summary: [visualizer] NPE when closing visualizer with nothing selected in debug view
Status: VERIFIED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-debug-dsf-gdb (show other bugs)
Version: 8.2   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 8.2.1   Edit
Assignee: Marc Dumais CLA
QA Contact: Marc Khouzam CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-24 11:23 EDT by Marc Dumais CLA
Modified: 2013-09-03 01:48 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marc Dumais CLA 2013-05-24 11:23:24 EDT
The NPE below happens when closing the Multicore Visualizer view, but apparently only when nothing at that time is selected in the debug view.  It seems that the canvas object is null in those cases, and the value is not checked before making an operation on it.

 java.lang.NullPointerException
	at org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.view.MulticoreVisualizer.workbenchToVisualizerSelection(MulticoreVisualizer.java:822)
	at org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.view.MulticoreVisualizer.updateCanvasSelectionInternal(MulticoreVisualizer.java:976)
	at org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.view.MulticoreVisualizer.updateCanvasSelectionInternal(MulticoreVisualizer.java:969)
	at org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.view.MulticoreVisualizer$4.run(MulticoreVisualizer.java:961)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
Comment 1 Marc Dumais CLA 2013-06-20 08:25:45 EDT
To reproduce, start a debug session with the multicore visualizer open.  From the visualizer, control-click any selected object to de-select them.  With all objects de-selected, close the visualizer window.

It seems that what's happening is a race condition between the visualizer's canvas being disposed and a workbench selection update in the visualizer, trying to access the canvas.
Comment 2 Marc Dumais CLA 2013-06-20 09:37:09 EDT
Proposed patch:  basically just a null check to avoid the NPE.  In context, it doesn't make sense anyway to synchronize the canvas selection when disposing the view, so skipping this when the canvas is null seems to make sense.

https://git.eclipse.org/r/13950


w/r to the patch submitted in this bug, I declare the following:

1) that I am authorized to submit this code change
2) that the code is 100% my own work

Marc Dumais
Comment 3 William Swanson CLA 2013-06-20 10:45:30 EDT
Fix submitted through Gerrit.
Comment 5 CDT Genie CLA 2013-06-28 12:22:12 EDT
*** cdt git genie on behalf of Marc Dumais ***

    Bug 409006 - [visualizer] NPE when closing visualizer with nothing
    selected in debug view
    Change-Id: If1c7fdbdd08822175e83eebc9fcd51b6bd859aae
    Reviewed-on: <a  href="https://git.eclipse.org/r/13950">https://git.eclipse.org/r/13950</a>
    Reviewed-by: William Swanson &lt;traveler@xxxxxxxxxx&gt;
    IP-Clean: William Swanson &lt;traveler@xxxxxxxxxx&gt;
    Tested-by: William Swanson &lt;traveler@xxxxxxxxxx&gt;

[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=06f0d1af10fcadd00afb196197568d3a576b4df1
Comment 6 Marc-André Laperle CLA 2013-09-03 01:48:02 EDT
Verified in 8.2.1 RC1 (EPP 20130821-2252).