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

List:       kde-commits
Subject:    kdebase/ksmserver
From:       Luboš Luňák <l.lunak () kde ! org>
Date:       2004-11-30 16:15:08
Message-ID: 20041130161508.14A851B947 () office ! kde ! org
[Download RAW message or body]

CVS commit by lunakl: 

When session save is cancelled, discard saved state created by it.
This should hopefully avoid old unused session data in share/config/session.
BUG: 88223


  M +17 -2     server.cpp   1.136


--- kdebase/ksmserver/server.cpp  #1.135:1.136
@@ -1075,6 +1075,14 @@ void KSMServer::saveCurrentSessionAs( QS
 void KSMServer::saveYourselfDone( KSMClient* client, bool success )
 {
-    if ( state == Idle )
+    if ( state == Idle ) {
+        // State saving when it's not shutdown or checkpoint. Probably
+        // a shutdown was cancelled and the client is finished saving
+        // only now. Discard the saved state in order to avoid
+        // the saved data building up.
+        QStringList discard = client->discardCommand();
+        if( !discard.isEmpty())
+            executeCommand( discard );
         return;
+    }
     if ( success ) {
         client->saveYourselfDone = true;
@@ -1166,6 +1174,13 @@ void KSMServer::cancelShutdown( KSMClien
     kdDebug( 1218 ) << "cancelShutdown: client " << c->program() << "(" << c->clientId() << ")" << endl;
     clientInteracting = 0;
-    for ( KSMClient* c = clients.first(); c; c = clients.next() )
+    for ( KSMClient* c = clients.first(); c; c = clients.next() ) {
         SmsShutdownCancelled( c->connection() );
+        if( c->saveYourselfDone ) {
+            // Discard also saved state.
+            QStringList discard = c->discardCommand();
+            if( !discard.isEmpty())
+                executeCommand( discard );
+        }
+    }
     state = Idle;
 }


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

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