From 4558fc1b449496ec26465a580259e0132b913644 Mon Sep 17 00:00:00 2001 From: rnv Date: Fri, 22 Mar 2019 10:59:36 +0300 Subject: [PATCH] 54519: [TC-9.3.0]: SIGSEGV during exit if dimensions are editing --- src/MeasureGUI/MeasureGUI_DimensionInteractor.cxx | 14 ++++++++------ src/MeasureGUI/MeasureGUI_DimensionInteractor.h | 3 ++- src/MeasureGUI/MeasureGUI_ManageDimensionsDlg.cxx | 5 ++++- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/MeasureGUI/MeasureGUI_DimensionInteractor.cxx b/src/MeasureGUI/MeasureGUI_DimensionInteractor.cxx index a41e49487..0777440a2 100644 --- a/src/MeasureGUI/MeasureGUI_DimensionInteractor.cxx +++ b/src/MeasureGUI/MeasureGUI_DimensionInteractor.cxx @@ -132,12 +132,14 @@ void MeasureGUI_DimensionInteractor::Disable() myIsEnabled = false; - // remove event filtering from viewer windows - QVector aViews = myVM->getViews(); - QVector::iterator aViewIt = aViews.begin(); - for ( ; aViewIt != aViews.end(); ++aViewIt ) - { - DisconnectView( *aViewIt ); + if (myVM) { + // remove event filtering from viewer windows + QVector aViews = myVM->getViews(); + QVector::iterator aViewIt = aViews.begin(); + for ( ; aViewIt != aViews.end(); ++aViewIt ) + { + DisconnectView( *aViewIt ); + } } } diff --git a/src/MeasureGUI/MeasureGUI_DimensionInteractor.h b/src/MeasureGUI/MeasureGUI_DimensionInteractor.h index 9343a9817..cde51bafd 100644 --- a/src/MeasureGUI/MeasureGUI_DimensionInteractor.h +++ b/src/MeasureGUI/MeasureGUI_DimensionInteractor.h @@ -29,6 +29,7 @@ #include #include +#include #include #include @@ -165,7 +166,7 @@ private: private: GeometryGUI* myGeomGUI; bool myIsEnabled; - OCCViewer_ViewManager* myVM; + QPointer myVM; OCCViewer_Viewer* myViewer; Operation myOperation; bool myOperationStarted; diff --git a/src/MeasureGUI/MeasureGUI_ManageDimensionsDlg.cxx b/src/MeasureGUI/MeasureGUI_ManageDimensionsDlg.cxx index de58cbcff..49a3f1478 100644 --- a/src/MeasureGUI/MeasureGUI_ManageDimensionsDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_ManageDimensionsDlg.cxx @@ -129,7 +129,7 @@ MeasureGUI_ManageDimensionsDlg::MeasureGUI_ManageDimensionsDlg( GeometryGUI* the connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( OnDeactivateThisDialog() ) ); connect( myGeomGUI, SIGNAL( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ); - myDimensionInteractor = new MeasureGUI_DimensionInteractor( theGUI, theParent ), + myDimensionInteractor = new MeasureGUI_DimensionInteractor( theGUI, this ), SelectionIntoArgument( Selection_Object ); @@ -245,6 +245,9 @@ void MeasureGUI_ManageDimensionsDlg::StartSelection( const Selection theSelectio //================================================================================= void MeasureGUI_ManageDimensionsDlg::StopSelection() { + if( !myGeomGUI || !myGeomGUI->getApp() || !myGeomGUI->getApp()->selectionMgr() ) + return; + if ( myCurrentSelection == Selection_Object ) { /* ----------------------------------------------- *