Salome HOME
Issue #800 Crash on call of pop-up menu of Part result
authornds <natalia.donis@opencascade.com>
Tue, 18 Aug 2015 12:00:49 +0000 (15:00 +0300)
committernds <natalia.donis@opencascade.com>
Wed, 19 Aug 2015 07:36:05 +0000 (10:36 +0300)
src/GeomAPI/GeomAPI_AISObject.cpp
src/ModuleBase/ModuleBase_ViewerFilters.cpp
src/XGUI/XGUI_Displayer.cpp
src/XGUI/XGUI_Selection.cpp

index fc34c50ae49953337cbd8279ae2a070a8b2eb488..10d720c835520e431bc0583e1e7e6215c5049639 100644 (file)
@@ -341,7 +341,9 @@ int GeomAPI_AISObject::getShapeType() const
   if (!anAIS.IsNull()) {
     Handle(AIS_Shape) aAISShape = Handle(AIS_Shape)::DownCast(anAIS);
     if (!aAISShape.IsNull()) {
-      return aAISShape->Shape().ShapeType();
+      const TopoDS_Shape aShape = aAISShape->Shape();
+      if (!aShape.IsNull())
+        return aShape.ShapeType();
     }
   }
   return -1;
index 6406ccca612aca59840aa253b243fbecf8c65f55..a3d20fce7aeb15047c49690a8c2880b4c2420616 100644 (file)
@@ -75,7 +75,7 @@ Standard_Boolean ModuleBase_ShapeInPlaneFilter::IsOk(const Handle(SelectMgr_Enti
     aValid = Standard_False;
     if (theOwner->HasSelectable()) {
       Handle(StdSelect_BRepOwner) aShapeOwner = Handle(StdSelect_BRepOwner)::DownCast(theOwner);
-      if (!aShapeOwner.IsNull()) {
+      if (!aShapeOwner.IsNull() && aShapeOwner->HasShape()) {
         TopoDS_Shape aShape = aShapeOwner->Shape();
         TopAbs_ShapeEnum aType = aShape.ShapeType();
         gp_Pln aPlane = myPlane->impl<gp_Pln>();
index f09ee4528ae6b0b47aff5296cef9fa4f902ef800..cb2503f0486e7522f106b6eab129bbf0db0a0004 100644 (file)
@@ -279,7 +279,8 @@ void XGUI_Displayer::redisplay(ObjectPtr theObject, bool theUpdateViewer)
         std::shared_ptr<GeomAPI_Shape> aShapePtr = ModelAPI_Tools::shape(aResult);
         if (aShapePtr.get()) {
           const TopoDS_Shape& aOldShape = aShapePrs->Shape();
-          isEqualShapes = aOldShape.IsEqual(aShapePtr->impl<TopoDS_Shape>());
+          if (!aOldShape.IsNull())
+            isEqualShapes = aOldShape.IsEqual(aShapePtr->impl<TopoDS_Shape>());
         }
       }
     }
index 27a3f18c2d0006089dce5ad343416bcbb765b39b..a8cd9cc3b35e678388857a52ee9eafbbada053ef 100644 (file)
@@ -117,7 +117,7 @@ void XGUI_Selection::fillPresentation(ModuleBase_ViewerPrs& thePrs,
   // we should not check the appearance of this feature because there can be some selected shapes
   // for one feature
   Handle(StdSelect_BRepOwner) aBRO = Handle(StdSelect_BRepOwner)::DownCast(theOwner);
-  if( !aBRO.IsNull() ) {
+  if( !aBRO.IsNull() && aBRO->HasShape() ) {
     // the located method is called in the context to obtain the shape by the SelectedShape() method,
     // so the shape is located by the same rules
     TopoDS_Shape aShape = aBRO->Shape().Located (aBRO->Location() * aBRO->Shape().Location());