diff --git a/ApplicationLibCode/Commands/RicDeleteItemExec.cpp b/ApplicationLibCode/Commands/RicDeleteItemExec.cpp index 86b4c0315d..19f4a932c5 100644 --- a/ApplicationLibCode/Commands/RicDeleteItemExec.cpp +++ b/ApplicationLibCode/Commands/RicDeleteItemExec.cpp @@ -65,9 +65,6 @@ void RicDeleteItemExec::redo() m_commandData.m_deletedObjectAsXml = xmlObj( obj )->writeObjectToXmlString(); } - // Make sure the object is disconnected from other objects before delete - obj->prepareForDelete(); - delete obj; listField->erase( m_commandData.m_indexToObject ); diff --git a/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp b/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp index aacec23df9..b21d690564 100644 --- a/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp +++ b/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp @@ -235,6 +235,10 @@ Rim3dView::~Rim3dView() { m_viewer->clearRimView(); } + + // Make sure the object is disconnected from other objects before delete + prepareForDelete(); + removeMdiWindowFromMdiArea(); delete m_viewer;