Salome HOME
Merge branch 'master' of newgeom:newgeom
[modules/shaper.git] / src / PartSet / PartSet_Module.cpp
index d94e396a6e0cc5f07f361025a851af08daef5463..2b92c351a5ec2fdf8a88d31fd0c77168050d70cb 100644 (file)
@@ -52,6 +52,7 @@
 //#include <SketchPlugin_ConstraintRigid.h>
 
 #include <Events_Loop.h>
+#include <Config_PropManager.h>
 
 #include <StdSelect_TypeOfFace.hxx>
 #include <TopoDS_Vertex.hxx>
@@ -134,6 +135,14 @@ void PartSet_Module::registerFilters()
             new ModuleBase_FilterCustom(aSelectFilter));
 }
 
+void PartSet_Module::registerProperties()
+{
+  Config_PropManager::registerProp("Sketch planes", "planes_size", "Size", Config_Prop::Double,
+                                   PLANE_SIZE);
+  Config_PropManager::registerProp("Sketch planes", "planes_thickness", "Thickness",
+                                   Config_Prop::Integer, SKETCH_WIDTH);
+}
+
 void PartSet_Module::operationCommitted(ModuleBase_Operation* theOperation) 
 {
   if (theOperation->isEditOperation())
@@ -196,11 +205,13 @@ bool PartSet_Module::canDisplayObject(const ObjectPtr& theObject) const
   if (aSketchFeature.get() != NULL) {
     FeaturePtr aFeature = ModelAPI_Feature::feature(theObject);
 
-    if (aFeature.get() != NULL) {
+    // MPV: the second and third conditions to avoid crash on exit for application
+    if (aFeature.get() != NULL && aFeature->data().get() && aFeature->data()->isValid()) {
       if (aFeature == aSketchFeature) {
         aCanDisplay = false;
       }
-      else {
+      else if (aSketchFeature.get() && aSketchFeature->data().get() &&
+               aSketchFeature->data()->isValid()) {
         for (int i = 0; i < aSketchFeature->numberOfSubs() && !aCanDisplay; i++) {
           FeaturePtr aSubFeature = aSketchFeature->subFeature(i);
           std::list<ResultPtr> aResults = aSubFeature->results();