From e93a07b43bb8ac423b407995ed13e1f28ecb6e2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20St=C3=B8ren?= Date: Thu, 30 Aug 2018 15:43:24 +0200 Subject: [PATCH] Fix missing blocking of selection manager update when updating table selection Caused crash in the Well Path editing (dragging targets) --- Fwk/AppFwk/cafUserInterface/cafPdmUiTableViewEditor.cpp | 6 ++++-- Fwk/AppFwk/cafUserInterface/cafPdmUiTableViewEditor.h | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTableViewEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiTableViewEditor.cpp index e17992a0c8..42342fe7c1 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTableViewEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTableViewEditor.cpp @@ -298,8 +298,10 @@ void PdmUiTableViewEditor::onSelectionManagerSelectionChanged(int selectionLevel QItemSelection itemSelection = m_tableModelPdm->modelIndexFromPdmObject(pdmObj); totalSelection.merge(itemSelection, QItemSelectionModel::Select); } - + + m_isUpdatingSelectionQModel = true; m_tableView->selectionModel()->select(totalSelection, QItemSelectionModel::SelectCurrent); + m_isUpdatingSelectionQModel = false; } } @@ -310,7 +312,7 @@ void PdmUiTableViewEditor::onSelectionManagerSelectionChanged(int selectionLevel //-------------------------------------------------------------------------------------------------- void PdmUiTableViewEditor::slotSelectionChanged(const QItemSelection & selected, const QItemSelection & deselected) { - updateSelectionManagerFromTableSelection(); + if (!m_isUpdatingSelectionQModel) updateSelectionManagerFromTableSelection(); } //-------------------------------------------------------------------------------------------------- diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTableViewEditor.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiTableViewEditor.h index 1b22d47aa8..fb99b5dada 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTableViewEditor.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTableViewEditor.h @@ -157,6 +157,7 @@ private: int m_tableSelectionLevel; int m_rowSelectionLevel; bool m_isBlockingSelectionManagerChanged; + bool m_isUpdatingSelectionQModel; caf::PdmChildArrayFieldHandle* m_previousFieldHandle; };