From 3a9418e989aabf61341c20e01628e43ca030c491 Mon Sep 17 00:00:00 2001 From: nds Date: Tue, 18 Aug 2015 15:00:49 +0300 Subject: [PATCH] Issue #800 Crash on call of pop-up menu of Part result --- src/GeomAPI/GeomAPI_AISObject.cpp | 4 +++- src/ModuleBase/ModuleBase_ViewerFilters.cpp | 2 +- src/XGUI/XGUI_Displayer.cpp | 3 ++- src/XGUI/XGUI_Selection.cpp | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/GeomAPI/GeomAPI_AISObject.cpp b/src/GeomAPI/GeomAPI_AISObject.cpp index fc34c50ae..10d720c83 100644 --- a/src/GeomAPI/GeomAPI_AISObject.cpp +++ b/src/GeomAPI/GeomAPI_AISObject.cpp @@ -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; diff --git a/src/ModuleBase/ModuleBase_ViewerFilters.cpp b/src/ModuleBase/ModuleBase_ViewerFilters.cpp index 6406ccca6..a3d20fce7 100644 --- a/src/ModuleBase/ModuleBase_ViewerFilters.cpp +++ b/src/ModuleBase/ModuleBase_ViewerFilters.cpp @@ -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(); diff --git a/src/XGUI/XGUI_Displayer.cpp b/src/XGUI/XGUI_Displayer.cpp index f09ee4528..cb2503f04 100644 --- a/src/XGUI/XGUI_Displayer.cpp +++ b/src/XGUI/XGUI_Displayer.cpp @@ -279,7 +279,8 @@ void XGUI_Displayer::redisplay(ObjectPtr theObject, bool theUpdateViewer) std::shared_ptr aShapePtr = ModelAPI_Tools::shape(aResult); if (aShapePtr.get()) { const TopoDS_Shape& aOldShape = aShapePrs->Shape(); - isEqualShapes = aOldShape.IsEqual(aShapePtr->impl()); + if (!aOldShape.IsNull()) + isEqualShapes = aOldShape.IsEqual(aShapePtr->impl()); } } } diff --git a/src/XGUI/XGUI_Selection.cpp b/src/XGUI/XGUI_Selection.cpp index 27a3f18c2..a8cd9cc3b 100644 --- a/src/XGUI/XGUI_Selection.cpp +++ b/src/XGUI/XGUI_Selection.cpp @@ -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()); -- 2.30.2