diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeSelectionQModel.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeSelectionQModel.cpp index b05bdee04e..0823e063bb 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeSelectionQModel.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeSelectionQModel.cpp @@ -151,12 +151,14 @@ void caf::PdmUiTreeSelectionQModel::setOptions(caf::PdmUiFieldEditorHandle* fiel { m_uiFieldHandle = field; - if (m_options.size() != options.size()) + bool mustRebuildOptionItemTree = m_options.size() != options.size(); + + m_options = options; + + if (mustRebuildOptionItemTree) { beginResetModel(); - m_options = options; - if (m_tree) { delete m_tree;