summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Dumais2013-06-20 09:34:59 (EDT)
committerWilliam Swanson2013-06-20 10:44:34 (EDT)
commit94a7ef56dd0dbc27676a6c823e709e9db6dfa653 (patch)
tree577f3b4d220b63aecb8bf842439b06e0829c8760
parent83752e91cf36c9b90bff5bcdd678a6ac02c3a53f (diff)
downloadorg.eclipse.cdt-94a7ef56dd0dbc27676a6c823e709e9db6dfa653.zip
org.eclipse.cdt-94a7ef56dd0dbc27676a6c823e709e9db6dfa653.tar.gz
org.eclipse.cdt-94a7ef56dd0dbc27676a6c823e709e9db6dfa653.tar.bz2
Bug 409006 - [visualizer] NPE when closing visualizer with nothingrefs/changes/50/13950/2
selected in debug view Change-Id: If1c7fdbdd08822175e83eebc9fcd51b6bd859aae Reviewed-on: https://git.eclipse.org/r/13950 Reviewed-by: William Swanson <traveler@tilera.com> IP-Clean: William Swanson <traveler@tilera.com> Tested-by: William Swanson <traveler@tilera.com>
-rwxr-xr-xdsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizer.java68
1 files changed, 35 insertions, 33 deletions
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizer.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizer.java
index aab4936..c5cc327 100755
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizer.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizer.java
@@ -12,6 +12,7 @@
* Marc Dumais (Ericsson) - Add CPU/core load information to the multicore visualizer (Bug 396268)
* Marc Dumais (Ericsson) - Bug 399419
* Marc Dumais (Ericsson) - Bug 405390
+ * Marc Dumais (Ericsson) - Bug 409006
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.view;
@@ -817,45 +818,46 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer
List<Object> items = SelectionUtils.getSelectedObjects(workbenchSelection);
- // Use the current canvas model to match Debug View items
- // with corresponding threads, if any.
- VisualizerModel model = m_canvas.getModel();
- if (model != null) {
-
- Set<Object> selected = new HashSet<Object>();
+ if (m_canvas != null) {
+ // Use the current canvas model to match Debug View items
+ // with corresponding threads, if any.
+ VisualizerModel model = m_canvas.getModel();
+ if (model != null) {
- for (Object item : items) {
-
- // Currently, we ignore selections other than DSF context objects.
- // TODO: any other cases where we could map selections to canvas?
- if (item instanceof IDMVMContext)
- {
- IDMContext context = ((IDMVMContext) item).getDMContext();
-
- IMIProcessDMContext processContext =
- DMContexts.getAncestorOfType(context, IMIProcessDMContext.class);
- int pid = Integer.parseInt(processContext.getProcId());
-
- IMIExecutionDMContext execContext =
- DMContexts.getAncestorOfType(context, IMIExecutionDMContext.class);
- int tid = (execContext == null) ? 0 : execContext.getThreadId();
-
- if (tid == 0) { // process
- List<VisualizerThread> threads = model.getThreadsForProcess(pid);
- if (threads != null) {
- selected.addAll(threads);
+ Set<Object> selected = new HashSet<Object>();
+
+ for (Object item : items) {
+
+ // Currently, we ignore selections other than DSF context objects.
+ // TODO: any other cases where we could map selections to canvas?
+ if (item instanceof IDMVMContext)
+ {
+ IDMContext context = ((IDMVMContext) item).getDMContext();
+
+ IMIProcessDMContext processContext =
+ DMContexts.getAncestorOfType(context, IMIProcessDMContext.class);
+ int pid = Integer.parseInt(processContext.getProcId());
+
+ IMIExecutionDMContext execContext =
+ DMContexts.getAncestorOfType(context, IMIExecutionDMContext.class);
+ int tid = (execContext == null) ? 0 : execContext.getThreadId();
+
+ if (tid == 0) { // process
+ List<VisualizerThread> threads = model.getThreadsForProcess(pid);
+ if (threads != null) {
+ selected.addAll(threads);
+ }
}
- }
- else { // thread
- VisualizerThread thread = model.getThread(tid);
- if (thread != null) {
- selected.add(thread);
+ else { // thread
+ VisualizerThread thread = model.getThread(tid);
+ if (thread != null) {
+ selected.add(thread);
+ }
}
}
}
+ visualizerSelection = SelectionUtils.toSelection(selected);
}
-
- visualizerSelection = SelectionUtils.toSelection(selected);
}
return visualizerSelection;