From: vsr Date: Fri, 10 Nov 2017 09:09:08 +0000 (+0300) Subject: 0023504: [CEA 2193] Segmentation fault at SALOME close (GEOM/Preferences) X-Git-Tag: V8_4_0rc3~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=40f474f3572064632fafc804814f5f5a887ccb79;p=modules%2Fgui.git 0023504: [CEA 2193] Segmentation fault at SALOME close (GEOM/Preferences) --- diff --git a/src/LightApp/LightApp_Application.cxx b/src/LightApp/LightApp_Application.cxx index e770b1508..529725ad4 100644 --- a/src/LightApp/LightApp_Application.cxx +++ b/src/LightApp/LightApp_Application.cxx @@ -246,6 +246,14 @@ int LightApp_Application::lastStudyId = 0; //since the 'toolbar marker' is not unique, find index of first occurrence of the //'toolbar marker' in the array and check that next string is name of the toolbar +void LightAppCleanUpAppResources() +{ + if ( LightApp_Application::_prefs_ ) { + delete LightApp_Application::_prefs_; + LightApp_Application::_prefs_ = 0; + } +} + namespace { int getToolbarMarkerIndex( QByteArray input, const QStringList& aFlags ) { @@ -439,6 +447,7 @@ LightApp_Application::~LightApp_Application() savePreferences(); delete mySelMgr; delete myScreenHelper; + myPrefs = 0; } /*!Start application.*/ @@ -2128,6 +2137,7 @@ LightApp_Preferences* LightApp_Application::preferences( const bool crt ) const { _prefs_ = new LightApp_Preferences( resourceMgr() ); that->createPreferences( _prefs_ ); + qAddPostRoutine( LightAppCleanUpAppResources ); } that->myPrefs = _prefs_; diff --git a/src/LightApp/LightApp_Application.h b/src/LightApp/LightApp_Application.h index b7d2fb9ec..cd9ce2e15 100644 --- a/src/LightApp/LightApp_Application.h +++ b/src/LightApp/LightApp_Application.h @@ -343,6 +343,8 @@ protected: static int lastStudyId; QStringList myUserWmTypes; + + friend void LightAppCleanUpAppResources(); }; #ifdef WIN32