From deed7a286b0da886e8ef021a572814abf5a9d3b8 Mon Sep 17 00:00:00 2001 From: vsv Date: Fri, 4 Oct 2019 12:02:25 +0300 Subject: [PATCH] Avoid crash on closing a viewer and deactivation of the module --- src/XGUI/XGUI_SelectionActivate.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) 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); + } } } -- 2.39.2