From: vsv Date: Fri, 4 Oct 2019 09:02:25 +0000 (+0300) Subject: Avoid crash on closing a viewer and deactivation of the module X-Git-Tag: V9_4_0a2~4^2~13 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=deed7a286b0da886e8ef021a572814abf5a9d3b8;p=modules%2Fshaper.git Avoid crash on closing a viewer and deactivation of the module --- diff --git a/src/XGUI/XGUI_SelectionActivate.cpp b/src/XGUI/XGUI_SelectionActivate.cpp index 62433d9f3..10b1d84e5 100644 --- a/src/XGUI/XGUI_SelectionActivate.cpp +++ b/src/XGUI/XGUI_SelectionActivate.cpp @@ -549,14 +549,16 @@ void XGUI_SelectionActivate::deactivateTrihedron(const bool theUpdateViewer) con void XGUI_SelectionActivate::deactivateTrihedronInSelectionModes() { Handle(AIS_InteractiveContext) aContext = AISContext(); - Handle(AIS_Trihedron) aTrihedron = Handle(AIS_Trihedron)::DownCast(getTrihedron()); - /// deactivate trihedron in selection modes - TColStd_ListOfInteger aTColModes; - aContext->ActivatedModes(aTrihedron, aTColModes); - TColStd_ListIteratorOfListOfInteger itr( aTColModes ); - for (; itr.More(); itr.Next() ) { - Standard_Integer aMode = itr.Value(); - aContext->Deactivate(aTrihedron, aMode); + if (!aContext.IsNull()) { + Handle(AIS_Trihedron) aTrihedron = Handle(AIS_Trihedron)::DownCast(getTrihedron()); + /// deactivate trihedron in selection modes + TColStd_ListOfInteger aTColModes; + aContext->ActivatedModes(aTrihedron, aTColModes); + TColStd_ListIteratorOfListOfInteger itr(aTColModes); + for (; itr.More(); itr.Next()) { + Standard_Integer aMode = itr.Value(); + aContext->Deactivate(aTrihedron, aMode); + } } }