From: ptv Date: Wed, 9 Nov 2005 14:51:24 +0000 (+0000) Subject: remove dead widget container from windows map X-Git-Tag: V3_1_0a3~41 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=9912133bfc94786da1b81666bf944de14d29cd77;p=modules%2Fgui.git remove dead widget container from windows map --- diff --git a/src/LightApp/LightApp_Application.cxx b/src/LightApp/LightApp_Application.cxx index dac8a5223..3fc89457e 100644 --- a/src/LightApp/LightApp_Application.cxx +++ b/src/LightApp/LightApp_Application.cxx @@ -850,7 +850,9 @@ void LightApp_Application::addWindow( QWidget* wid, const int flag, const int st QMap winMap; currentWindows( winMap ); - myWindows.insert( flag, new LightApp_WidgetContainer( flag, desktop() ) ); + LightApp_WidgetContainer* newWC = new LightApp_WidgetContainer( flag, desktop() ); + connect( newWC, SIGNAL( destroyed ( QObject* ) ), this, SLOT( onWCDestroyed( QObject* ) ) ); + myWindows.insert( flag, newWC ); if ( winMap.contains( flag ) ) desktop()->moveDockWindow( myWindows[flag], (Dock)winMap[flag] ); @@ -1838,3 +1840,18 @@ SUIT_Accel* LightApp_Application::accel() const { return myAccel; } + +/*! remove dead widget container from map */ +void LightApp_Application::onWCDestroyed( QObject* ob ) +{ + // remove destroyed widget container from windows map + for ( WindowMap::ConstIterator itr = myWindows.begin(); itr != myWindows.end(); ++itr ) + { + if ( itr.data() != ob ) + continue; + + int key = itr.key(); + myWindows.remove( key ); + break; + } +} diff --git a/src/LightApp/LightApp_Application.h b/src/LightApp/LightApp_Application.h index cfb459fba..ef00439de 100644 --- a/src/LightApp/LightApp_Application.h +++ b/src/LightApp/LightApp_Application.h @@ -141,6 +141,8 @@ protected slots: void onStudySaved( SUIT_Study* ); void onStudyClosed( SUIT_Study* ); + void onWCDestroyed( QObject* ); + private slots: void onSelection(); void onRefresh();