mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-15 13:05:22 +02:00
Bug 409006 - [visualizer] NPE when closing visualizer with nothing
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>
This commit is contained in:
parent
f02d888142
commit
06f0d1af10
1 changed files with 35 additions and 33 deletions
|
@ -12,6 +12,7 @@
|
||||||
* Marc Dumais (Ericsson) - Add CPU/core load information to the multicore visualizer (Bug 396268)
|
* Marc Dumais (Ericsson) - Add CPU/core load information to the multicore visualizer (Bug 396268)
|
||||||
* Marc Dumais (Ericsson) - Bug 399419
|
* Marc Dumais (Ericsson) - Bug 399419
|
||||||
* Marc Dumais (Ericsson) - Bug 405390
|
* Marc Dumais (Ericsson) - Bug 405390
|
||||||
|
* Marc Dumais (Ericsson) - Bug 409006
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.view;
|
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);
|
List<Object> items = SelectionUtils.getSelectedObjects(workbenchSelection);
|
||||||
|
|
||||||
// Use the current canvas model to match Debug View items
|
if (m_canvas != null) {
|
||||||
// with corresponding threads, if any.
|
// Use the current canvas model to match Debug View items
|
||||||
VisualizerModel model = m_canvas.getModel();
|
// with corresponding threads, if any.
|
||||||
if (model != null) {
|
VisualizerModel model = m_canvas.getModel();
|
||||||
|
if (model != null) {
|
||||||
Set<Object> selected = new HashSet<Object>();
|
|
||||||
|
|
||||||
for (Object item : items) {
|
Set<Object> selected = new HashSet<Object>();
|
||||||
|
|
||||||
// Currently, we ignore selections other than DSF context objects.
|
for (Object item : items) {
|
||||||
// TODO: any other cases where we could map selections to canvas?
|
|
||||||
if (item instanceof IDMVMContext)
|
// Currently, we ignore selections other than DSF context objects.
|
||||||
{
|
// TODO: any other cases where we could map selections to canvas?
|
||||||
IDMContext context = ((IDMVMContext) item).getDMContext();
|
if (item instanceof IDMVMContext)
|
||||||
|
{
|
||||||
IMIProcessDMContext processContext =
|
IDMContext context = ((IDMVMContext) item).getDMContext();
|
||||||
DMContexts.getAncestorOfType(context, IMIProcessDMContext.class);
|
|
||||||
int pid = Integer.parseInt(processContext.getProcId());
|
IMIProcessDMContext processContext =
|
||||||
|
DMContexts.getAncestorOfType(context, IMIProcessDMContext.class);
|
||||||
IMIExecutionDMContext execContext =
|
int pid = Integer.parseInt(processContext.getProcId());
|
||||||
DMContexts.getAncestorOfType(context, IMIExecutionDMContext.class);
|
|
||||||
int tid = (execContext == null) ? 0 : execContext.getThreadId();
|
IMIExecutionDMContext execContext =
|
||||||
|
DMContexts.getAncestorOfType(context, IMIExecutionDMContext.class);
|
||||||
if (tid == 0) { // process
|
int tid = (execContext == null) ? 0 : execContext.getThreadId();
|
||||||
List<VisualizerThread> threads = model.getThreadsForProcess(pid);
|
|
||||||
if (threads != null) {
|
if (tid == 0) { // process
|
||||||
selected.addAll(threads);
|
List<VisualizerThread> threads = model.getThreadsForProcess(pid);
|
||||||
|
if (threads != null) {
|
||||||
|
selected.addAll(threads);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
else { // thread
|
||||||
else { // thread
|
VisualizerThread thread = model.getThread(tid);
|
||||||
VisualizerThread thread = model.getThread(tid);
|
if (thread != null) {
|
||||||
if (thread != null) {
|
selected.add(thread);
|
||||||
selected.add(thread);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
visualizerSelection = SelectionUtils.toSelection(selected);
|
||||||
}
|
}
|
||||||
|
|
||||||
visualizerSelection = SelectionUtils.toSelection(selected);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return visualizerSelection;
|
return visualizerSelection;
|
||||||
|
|
Loading…
Add table
Reference in a new issue