[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdenonbeta/kopete/libkopete
From:       Jason Keirstead <jason () keirstead ! org>
Date:       2003-01-30 0:16:39
[Download RAW message or body]

CVS commit by brunes: 

Put in a few hacks to ensure the destructors of all KopeteChatWindows are called on \
exit


  M +6 -1      kopetemessagemanagerfactory.cpp   1.31
  M +1 -1      ui/chatview.cpp   1.96
  M +24 -10    ui/kopetechatwindow.cpp   1.108
  M +3 -0      ui/kopetechatwindow.h   1.57


--- kdenonbeta/kopete/libkopete/kopetemessagemanagerfactory.cpp  #1.30:1.31
@@ -169,4 +168,10 @@ void KopeteMessageManagerFactory::cleanS
 {
         KopeteMessageManagerDict sessions = protocolSessions( protocol );
+        QIntDictIterator<KopeteMessageManager> it( sessions );
+        for ( ; it.current() ; ++it )
+        {
+                kdDebug( 14010 ) << k_funcinfo << "Unloading KMM " << \
it.current()->user()->displayName() << endl; +                \
it.current()->deleteLater(); +        }
         sessions.setAutoDelete( true );
         sessions.clear();

--- kdenonbeta/kopete/libkopete/ui/kopetechatwindow.cpp  #1.107:1.108
@@ -61,16 +61,13 @@ KopeteChatWindow::KopeteChatWindow(QWidg
         readOptions();
         backgroundFile = 0L;
+        m_viewCount = 0;
 }
 
 KopeteChatWindow::~KopeteChatWindow()
 {
-//      kdDebug(14010) << "KopeteChatWindow::~KopeteChatWindow()" << endl;
-        if( backgroundFile != 0L )
-        {
-                backgroundFile->close();
-                backgroundFile->unlink();
-        }
-        emit Closing();
-        saveOptions();
+        kdDebug(14010) << k_funcinfo << endl;
+        m_viewCount = 0;
+        slotViewClosed();
+        if( m_activeView )
         m_activeView->saveOptions();
 }
@@ -255,4 +252,5 @@ ChatView *KopeteChatWindow::addChatView(
 
         connect( mainView, SIGNAL(headerCloseButtonClicked()), mainView, \
SLOT(deleteLater()) ); +        connect( m_activeView, SIGNAL(Closing()), this, \
SLOT(slotViewClosed()) );  
         if( mainView->parentDockTabGroup() )
@@ -263,6 +261,22 @@ ChatView *KopeteChatWindow::addChatView(
 
         updateMembersActions();
+        m_viewCount++;
         
         return m_activeView;
+}
+
+void KopeteChatWindow::slotViewClosed()
+{
+        --m_viewCount;
+        if( m_viewCount <= 0 )
+        {
+                if( backgroundFile != 0L )
+                {
+                        backgroundFile->close();
+                        backgroundFile->unlink();
+                }
+                saveOptions();
+                emit Closing();
+        }
 }
 

--- kdenonbeta/kopete/libkopete/ui/kopetechatwindow.h  #1.56:1.57
@@ -86,4 +86,5 @@ private:
         bool widgetSet;
         const KopeteContact     *m_us;
+        int m_viewCount;
 
         KAction* editCut;
@@ -144,4 +145,6 @@ private slots:
         void slotViewMembersRight();
         void slotViewMembersNone();
+        
+        void slotViewClosed();
 
 protected:


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic