diff --git a/visualization/motion_planning_tasks/src/task_panel.cpp b/visualization/motion_planning_tasks/src/task_panel.cpp index ae6072c6..2a008bda 100644 --- a/visualization/motion_planning_tasks/src/task_panel.cpp +++ b/visualization/motion_planning_tasks/src/task_panel.cpp @@ -260,10 +260,10 @@ void TaskView::onCurrentStageChanged(const QModelIndex ¤t, const QModelInd QAbstractItemModel *m = task ? task->getSolutionModel(task_index) : nullptr; view->sortByColumn(-1); view->setModel(m); - delete sm; // we don't store the selection model + if (sm) delete sm; // we don't store the selection model + sm = view->selectionModel(); - if (m) { - sm = view->selectionModel(); + if (sm) { connect(sm, SIGNAL(currentChanged(QModelIndex, QModelIndex)), this, SLOT(onCurrentSolutionChanged(QModelIndex,QModelIndex))); connect(sm, SIGNAL(selectionChanged(QItemSelection, QItemSelection)),