From 4ce1fd8af764a1293ff5c54ef2bd723864fe8cdb Mon Sep 17 00:00:00 2001 From: vsv Date: Tue, 15 Oct 2019 18:10:48 +0300 Subject: [PATCH] Issue #3041: prevent crash on change sketch plane --- src/PartSet/PartSet_WidgetSketchLabel.cpp | 1 + src/SketcherPrs/SketcherPrs_Angle.cpp | 2 ++ src/SketcherPrs/SketcherPrs_LengthDimension.cpp | 2 ++ src/SketcherPrs/SketcherPrs_Radius.cpp | 2 ++ src/SketcherPrs/SketcherPrs_SymbolPrs.cpp | 2 ++ 5 files changed, 9 insertions(+) diff --git a/src/PartSet/PartSet_WidgetSketchLabel.cpp b/src/PartSet/PartSet_WidgetSketchLabel.cpp index 548d01d13..2ba13e6bd 100644 --- a/src/PartSet/PartSet_WidgetSketchLabel.cpp +++ b/src/PartSet/PartSet_WidgetSketchLabel.cpp @@ -734,6 +734,7 @@ void PartSet_WidgetSketchLabel::onChangePlane() SessionPtr aMgr = ModelAPI_Session::get(); aMgr->startOperation("Change Sketch plane"); myOpenTransaction = true; + myWorkshop->viewer()->update(); } } diff --git a/src/SketcherPrs/SketcherPrs_Angle.cpp b/src/SketcherPrs/SketcherPrs_Angle.cpp index 3a876982b..f5bcf8e3d 100644 --- a/src/SketcherPrs/SketcherPrs_Angle.cpp +++ b/src/SketcherPrs/SketcherPrs_Angle.cpp @@ -165,6 +165,8 @@ void SketcherPrs_Angle::Compute(const Handle(PrsMgr_PresentationManager3d)& theP const Handle(Prs3d_Presentation)& thePresentation, const Standard_Integer theMode) { + if (!plane().get()) + return; gp_Pnt aFirstPoint, aSecondPoint, aCenterPoint; bool aReadyToDisplay = readyToDisplay(myConstraint, plane(), aFirstPoint, aSecondPoint, aCenterPoint); diff --git a/src/SketcherPrs/SketcherPrs_LengthDimension.cpp b/src/SketcherPrs/SketcherPrs_LengthDimension.cpp index b895b6d6b..6f1179f59 100644 --- a/src/SketcherPrs/SketcherPrs_LengthDimension.cpp +++ b/src/SketcherPrs/SketcherPrs_LengthDimension.cpp @@ -147,6 +147,8 @@ void SketcherPrs_LengthDimension::Compute( const Handle(Prs3d_Presentation)& thePresentation, const Standard_Integer theMode) { + if (!plane().get()) + return; gp_Pnt aPnt1, aPnt2; bool aReadyToDisplay = readyToDisplay(myConstraint, plane(), aPnt1, aPnt2); if (aReadyToDisplay) { diff --git a/src/SketcherPrs/SketcherPrs_Radius.cpp b/src/SketcherPrs/SketcherPrs_Radius.cpp index 8d3355d77..bd10874fc 100644 --- a/src/SketcherPrs/SketcherPrs_Radius.cpp +++ b/src/SketcherPrs/SketcherPrs_Radius.cpp @@ -145,6 +145,8 @@ void SketcherPrs_Radius::Compute( const Handle(Prs3d_Presentation)& thePresentation, const Standard_Integer theMode) { + if (!plane().get()) + return; gp_Circ aCircle; gp_Pnt anAnchorPoint; bool aReadyToDisplay = readyToDisplay(myConstraint, plane(), aCircle, anAnchorPoint); diff --git a/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp b/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp index a251d2539..5f79c5fba 100644 --- a/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp +++ b/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp @@ -274,6 +274,8 @@ void SketcherPrs_SymbolPrs::Compute( const Handle(Prs3d_Presentation)& thePresentation, const Standard_Integer theMode) { + if (!plane().get()) + return; // Create an icon prepareAspect(); -- 2.39.2