From 4ba123816d90f754f7852ac08aad034af4081961 Mon Sep 17 00:00:00 2001 From: mpv Date: Mon, 26 May 2014 15:27:12 +0400 Subject: [PATCH] Fixed crash on exotic case: many undo-redo on sketch entity and after selection of appeared object --- src/ModuleBase/ModuleBase_WidgetPoint2D.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/ModuleBase/ModuleBase_WidgetPoint2D.cpp b/src/ModuleBase/ModuleBase_WidgetPoint2D.cpp index 01f9902eb..623eaae63 100644 --- a/src/ModuleBase/ModuleBase_WidgetPoint2D.cpp +++ b/src/ModuleBase/ModuleBase_WidgetPoint2D.cpp @@ -11,6 +11,7 @@ #include #include +#include #include #include @@ -70,6 +71,10 @@ ModuleBase_WidgetPoint2D::~ModuleBase_WidgetPoint2D() bool ModuleBase_WidgetPoint2D::storeValue(boost::shared_ptr theFeature) { boost::shared_ptr aData = theFeature->data(); + if (!aData) { + ObjectPtr anObj = boost::dynamic_pointer_cast(theFeature); + if (anObj) aData = anObj->featureRef()->data(); + } boost::shared_ptr aPoint = boost::dynamic_pointer_cast(aData->attribute(myFeatureAttributeID)); @@ -84,6 +89,10 @@ bool ModuleBase_WidgetPoint2D::storeValue(boost::shared_ptr th bool ModuleBase_WidgetPoint2D::restoreValue(boost::shared_ptr theFeature) { boost::shared_ptr aData = theFeature->data(); + if (!aData) { + ObjectPtr anObj = boost::dynamic_pointer_cast(theFeature); + if (anObj) aData = anObj->featureRef()->data(); + } boost::shared_ptr aPoint = boost::dynamic_pointer_cast(aData->attribute(myFeatureAttributeID)); -- 2.39.2