]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
remove dead widget container from windows map
authorptv <ptv@opencascade.com>
Wed, 9 Nov 2005 14:51:24 +0000 (14:51 +0000)
committerptv <ptv@opencascade.com>
Wed, 9 Nov 2005 14:51:24 +0000 (14:51 +0000)
src/LightApp/LightApp_Application.cxx
src/LightApp/LightApp_Application.h

index dac8a5223f8c879c4032d6cb1d60525da864b8c0..3fc89457e44f16256717d3111ac913bc1753835e 100644 (file)
@@ -850,7 +850,9 @@ void LightApp_Application::addWindow( QWidget* wid, const int flag, const int st
     QMap<int, int> 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;
+  }
+}
index cfb459fbaad9eadb3e485584a1db43e7f6a17015..ef00439dea442b758dbca004e63ba0e7f9a8648a 100644 (file)
@@ -141,6 +141,8 @@ protected slots:
   void                                onStudySaved( SUIT_Study* );
   void                                onStudyClosed( SUIT_Study* );
 
+  void                                onWCDestroyed( QObject* );
+
 private slots:
   void                                onSelection();
   void                                onRefresh();