From 86c8fa707137efe87ce6fe95c39123a66ce82068 Mon Sep 17 00:00:00 2001 From: mpv Date: Sun, 12 Nov 2017 16:02:27 +0300 Subject: [PATCH] Avoid possible problem on the document delete or close (if results contain compsolids). --- src/Model/Model_ResultBody.cpp | 2 +- src/ModelAPI/ModelAPI_Result.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Model/Model_ResultBody.cpp b/src/Model/Model_ResultBody.cpp index f69c4d604..731a520de 100644 --- a/src/Model/Model_ResultBody.cpp +++ b/src/Model/Model_ResultBody.cpp @@ -47,7 +47,7 @@ void Model_ResultBody::colorConfigInfo(std::string& theSection, std::string& the bool Model_ResultBody::setDisabled(std::shared_ptr theThis, const bool theFlag) { bool aChanged = ModelAPI_ResultBody::setDisabled(theThis, theFlag); - if (aChanged) { // state is changed, so modifications are needed + if (aChanged && data()->isValid()) { // state is changed, so modifications are needed myBuilder->evolutionToSelection(theFlag); } return aChanged; diff --git a/src/ModelAPI/ModelAPI_Result.cpp b/src/ModelAPI/ModelAPI_Result.cpp index 4aac574bf..588d138bf 100644 --- a/src/ModelAPI/ModelAPI_Result.cpp +++ b/src/ModelAPI/ModelAPI_Result.cpp @@ -44,7 +44,8 @@ bool ModelAPI_Result::setDisabled(std::shared_ptr theThis, cons { if (myIsDisabled != theFlag) { myIsDisabled = theFlag; - data()->setIsDeleted(theFlag); // store it in data model (to get back on undo/redo, etc) + if (data()->isValid()) + data()->setIsDeleted(theFlag); // store it in data model (to get back on undo/redo, etc) // this must be before "updated" message send to have history updated for OB update document()->updateHistory(groupName()); // to update the history cash data in the document // generate related events -- 2.39.2