From: mpv Date: Thu, 14 May 2020 08:30:38 +0000 (+0300) Subject: Fix for the problem of referencing to the attributes by pointers in messages. It... X-Git-Tag: V9_5_0b1~9 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=6e5cc7d936a40ae7f2239d7621a4e889c3a9f440;p=modules%2Fshaper.git 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. --- 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)) &&