From 40f474f3572064632fafc804814f5f5a887ccb79 Mon Sep 17 00:00:00 2001 From: vsr Date: Fri, 10 Nov 2017 12:09:08 +0300 Subject: [PATCH] 0023504: [CEA 2193] Segmentation fault at SALOME close (GEOM/Preferences) --- src/LightApp/LightApp_Application.cxx | 10 ++++++++++ src/LightApp/LightApp_Application.h | 2 ++ 2 files changed, 12 insertions(+) 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 -- 2.39.2