]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Fixed crash on exotic case: many undo-redo on sketch entity and after selection of...
authormpv <mikhail.ponikarov@opencascade.com>
Mon, 26 May 2014 11:27:12 +0000 (15:27 +0400)
committermpv <mikhail.ponikarov@opencascade.com>
Mon, 26 May 2014 11:27:12 +0000 (15:27 +0400)
src/ModuleBase/ModuleBase_WidgetPoint2D.cpp

index 01f9902eb5fa4918500cf931b6f3905b44eb8d50..623eaae6392f1c774103ac809ef28750d29cdce3 100644 (file)
@@ -11,6 +11,7 @@
 
 #include <ModelAPI_Feature.h>
 #include <ModelAPI_Data.h>
+#include <ModelAPI_Object.h>
 #include <GeomDataAPI_Point2D.h>
 
 #include <QGroupBox>
@@ -70,6 +71,10 @@ ModuleBase_WidgetPoint2D::~ModuleBase_WidgetPoint2D()
 bool ModuleBase_WidgetPoint2D::storeValue(boost::shared_ptr<ModelAPI_Feature> theFeature)
 {
   boost::shared_ptr<ModelAPI_Data> aData = theFeature->data();
+  if (!aData) {
+     ObjectPtr anObj = boost::dynamic_pointer_cast<ModelAPI_Object>(theFeature);
+     if (anObj) aData = anObj->featureRef()->data();
+  }
   boost::shared_ptr<GeomDataAPI_Point2D> aPoint =
     boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(myFeatureAttributeID));
 
@@ -84,6 +89,10 @@ bool ModuleBase_WidgetPoint2D::storeValue(boost::shared_ptr<ModelAPI_Feature> th
 bool ModuleBase_WidgetPoint2D::restoreValue(boost::shared_ptr<ModelAPI_Feature> theFeature)
 {
   boost::shared_ptr<ModelAPI_Data> aData = theFeature->data();
+  if (!aData) {
+     ObjectPtr anObj = boost::dynamic_pointer_cast<ModelAPI_Object>(theFeature);
+     if (anObj) aData = anObj->featureRef()->data();
+  }
   boost::shared_ptr<GeomDataAPI_Point2D> aPoint =
     boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(myFeatureAttributeID));