Bug 416524 - [Visualizer] NPE first session in C++ perspective
Summary: [Visualizer] NPE first session in C++ perspective
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-debug-dsf-gdb (show other bugs)
Version: 8.2.1   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-09-04 10:13 EDT by Alvaro Sanchez-Leon CLA
Modified: 2013-09-05 16:22 EDT (History)
3 users (show)

See Also:


Attachments
stack trace (5.56 KB, text/plain)
2013-09-04 10:15 EDT, Alvaro Sanchez-Leon CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alvaro Sanchez-Leon CLA 2013-09-04 10:13:56 EDT
A Null pointer exception is triggered the very first debug session while in the C++ perspective, 
There does not seem to be a user impact as the visualizer behaves properly once the multi-core visualizer view is available.
Comment 1 Alvaro Sanchez-Leon CLA 2013-09-04 10:15:30 EDT
Created attachment 235151 [details]
stack trace
Comment 2 Marc Dumais CLA 2013-09-05 07:28:42 EDT
Hi,

I am sometimes able to reproduce the NPE.  I think it's a race condition at startup of the first debug session, where some of the time we process debug events and try to update the visualizer model before it has had the chance to be created.  

It doesn't make sense to try to update the model if it doesn't exist yet, so a simple way to prevent the NPEs is to check if the model is null before trying to update it.  Nothing important will be lost since the model will be created soon after from the latest state of the debug session.

I will submit a patch for this soon.  Thanks for reporting the issue.
Comment 3 Marc Dumais CLA 2013-09-05 08:26:32 EDT
Here is the proposed patch.  While investigating this bug, I noticed that if I protect only for the specific NPE described here, other similar NPEs happen in the other listener methods.  So I have added protection to all listener methods that modify the visualizer model.  

https://git.eclipse.org/r/16156
Comment 5 CDT Genie CLA 2013-09-05 16:22:03 EDT
*** cdt git genie on behalf of Marc Dumais ***

    Bug 416524 - [Visualizer] NPE first session in C++ perspective
    Change-Id: I586bccc85b043d7e1cadf5298aaf3c22bb79e950
    Reviewed-on: <a  href="https://git.eclipse.org/r/16156">https://git.eclipse.org/r/16156</a>
    Reviewed-by: Alvaro Sanchez-Leon &lt;alvsan09@xxxxxxxxx&gt;
    Reviewed-by: Marc Khouzam &lt;marc.khouzam@xxxxxxxxxxxx&gt;
    IP-Clean: Marc Khouzam &lt;marc.khouzam@xxxxxxxxxxxx&gt;
    Tested-by: Marc Khouzam &lt;marc.khouzam@xxxxxxxxxxxx&gt;
    Signed-off-by: Marc Khouzam &lt;marc.khouzam@xxxxxxxxxxxx&gt;
    Signed-off-by: Marc Dumais &lt;marc.dumais@xxxxxxxxxxxx&gt;

[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=02393d61f18f0ac50f4d32e23ba6177cf6e214e2