From 6e5cc7d936a40ae7f2239d7621a4e889c3a9f440 Mon Sep 17 00:00:00 2001 From: mpv Date: Thu, 14 May 2020 11:30:38 +0300 Subject: [PATCH] Fix for the problem of referencing to the attributes by pointers in messages. It caused crashes sometimes, for an example, in TestExport_FiniteValidator.py execution. --- src/Model/Model_Update.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Model/Model_Update.cpp b/src/Model/Model_Update.cpp index d006d4374..540bb8e14 100644 --- a/src/Model/Model_Update.cpp +++ b/src/Model/Model_Update.cpp @@ -913,6 +913,8 @@ void Model_Update::updateArguments(FeaturePtr theFeature) { std::dynamic_pointer_cast(*aRefsIter); // #19071 : avoid sending of update event in cycle bool aWasBlocked = theFeature->data()->blockSendAttributeUpdated(true); + // list to keep the shared pointers while update is blocked (in messages raw poiters are used) + std::list anAttrList; for(int a = aSel->size() - 1; a >= 0; a--) { std::shared_ptr aSelAttr = std::dynamic_pointer_cast(aSel->value(a)); @@ -921,6 +923,7 @@ void Model_Update::updateArguments(FeaturePtr theFeature) { // update argument only if the referenced object is ready to use if (aContext.get() && !aContext->isDisabled()) { if (isReason(theFeature, aContext)) { + anAttrList.push_back(aSelAttr); if (!aSelAttr->update()) { bool isObligatory = !aFactory->isNotObligatory( theFeature->getKind(), theFeature->data()->id(aSel)) && -- 2.39.2