[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-05-31 16:55:42
Message-ID: 20040531165542.9B66B2A45 () office ! kde ! org
[Download RAW message or body]
CVS commit by lunakl:
When killing clients on exit, give also phase2 clients a chance to exit
cleanly before ksmserver times out and exits in case some client doesn't
respond. Helps with #82128.
M +35 -8 server.cpp 1.125
M +2 -1 server.h 1.38
--- kdebase/ksmserver/server.cpp #1.124:1.125
@@ -897,5 +897,5 @@ void KSMServer::deleteClient( KSMClient*
if ( state == Shutdown || state == Checkpoint )
completeShutdownOrCheckpoint();
- if ( state == Killing )
+ if ( state == Killing || state == Killing2 )
completeKilling();
}
@@ -1241,5 +1241,5 @@ void KSMServer::completeShutdownOrCheckp
clients.count() << endl;
completeKilling();
- QTimer::singleShot( 4000, kapp, SLOT( quit() ) );
+ QTimer::singleShot( 4000, this, SLOT( timeoutQuit() ) );
} else if ( state == Checkpoint ) {
state = Idle;
@@ -1251,5 +1251,5 @@ void KSMServer::completeKilling()
kdDebug( 1218 ) << "KSMServer::completeKilling clients.count()=" <<
clients.count() << endl;
- if ( state != Killing ) {
+ if ( state != Killing && state != Killing2 ) {
// kdWarning() << "Not Killing !!! state=" << state << endl;
return;
@@ -1259,4 +1259,5 @@ void KSMServer::completeKilling()
kapp->quit();
} else {
+ if( state == Killing ) {
for (KSMClient *c = clients.first(); c; c = clients.next()) {
if (! c->wasPhase2)
@@ -1268,4 +1269,30 @@ void KSMServer::completeKilling()
}
}
+ else {
+ for (KSMClient *c = clients.first(); c; c = clients.next()) {
+ if (c->wasPhase2)
+ return;
+ }
+ // only clients from first phase of killing remain, don't time out
+ // second time just because of them
+ }
+ }
+}
+
+void KSMServer::timeoutQuit()
+{
+ state = Killing2;
+ bool kill_phase2 = false;
+ for (KSMClient *c = clients.first(); c; c = clients.next()) {
+ if (c->wasPhase2) {
+ kill_phase2 = true;
+ SmsDie( c->connection() );
+ } else {
+ kdWarning( 1218 ) << "SmsDie timeout, client " << c->program() << "(" << \
c->clientId() << ")" << endl; + }
+ }
+ if( !kill_phase2 )
+ kapp->quit();
+ QTimer::singleShot( 4000, kapp, SLOT( quit() ) );
}
--- kdebase/ksmserver/server.h #1.37:1.38
@@ -128,4 +128,5 @@ private slots:
void protectionTimeout();
+ void timeoutQuit();
void autoStart();
@@ -174,5 +175,5 @@ private:
QPtrList<KSMClient> clients;
- enum State { Idle, Shutdown, Checkpoint, Killing };
+ enum State { Idle, Shutdown, Checkpoint, Killing, Killing2 };
State state;
bool dialogActive;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic