From 1f1f7f5dd7b157f8289c1ef0ffc2fb65a53a0884 Mon Sep 17 00:00:00 2001 From: mpv Date: Wed, 24 Jun 2015 15:26:08 +0300 Subject: [PATCH] Fix for crash of undo/redo of part creation --- src/PartSetPlugin/PartSetPlugin_Part.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/PartSetPlugin/PartSetPlugin_Part.cpp b/src/PartSetPlugin/PartSetPlugin_Part.cpp index 09a768acf..fda4e53a1 100644 --- a/src/PartSetPlugin/PartSetPlugin_Part.cpp +++ b/src/PartSetPlugin/PartSetPlugin_Part.cpp @@ -10,6 +10,7 @@ #include "ModelAPI_Data.h" #include "ModelAPI_AttributeDocRef.h" #include +#include using namespace std; @@ -30,6 +31,12 @@ void PartSetPlugin_Part::execute() // do not activate part by simple execution if it is not loaded yet: it must be explicitly // activated for this if (!ModelAPI_Session::get()->isLoadByDemand(aResult->data()->name())) { + // On undo/redo creation of the part result the Object Borwser must get creation event + // earlier that activation of this part event (otherwise the crash is producted) + // So, send a creation event earlier, without any grouping + static Events_ID aCreateID = Events_Loop::eventByName(EVENT_OBJECT_CREATED); + ModelAPI_EventCreator::get()->sendUpdated(aResult, aCreateID, false); + aResult->activate(); } } -- 2.39.2