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

List:       kde-commits
Subject:    kdebase/ksmserver
From:       Oswald Buddenhagen <ossi () kde ! org>
Date:       2004-01-22 15:28:13
Message-ID: 20040122152813.CA60526C8 () office ! kde ! org
[Download RAW message or body]

CVS commit by ossi: 

don't write kdm's command fifo before the session shutdown is actually
complete.


  M +21 -17    server.cpp   1.122
  M +4 -0      server.h   1.37


--- kdebase/ksmserver/server.cpp  #1.121:1.122
@@ -701,4 +701,6 @@ KSMServer::KSMServer( const QString& win
     wm = windowManager;
 
+    shutdownType = KApplication::ShutdownTypeNone;
+
     state = Idle;
     dialogActive = false;
@@ -819,4 +821,19 @@ void KSMServer::cleanUp()
     signal(SIGTERM, SIG_DFL);
     signal(SIGINT, SIG_DFL);
+
+    if ( shutdownType != KApplication::ShutdownTypeNone ) {
+        QFile fifo( fifoName );
+        if ( fifo.open( IO_WriteOnly | IO_Raw ) ) {
+            QCString cmd( "shutdown\t" );
+            cmd.append( shutdownType == KApplication::ShutdownTypeReboot ?
+                        "reboot\t" : "halt\t" );
+            cmd.append( shutdownMode == KApplication::ShutdownModeForceNow ?
+                        "forcenow\n" :
+                        shutdownMode == KApplication::ShutdownModeTryNow ?
+                        "trynow\n" : "schedule\n" );
+            fifo.writeBlock( cmd.data(), cmd.length() );
+            fifo.close();
+        }
+    }
 }
 
@@ -913,14 +930,12 @@ void KSMServer::shutdown( KApplication::
     bool maysd, maynuke;
     KApplication::ShutdownMode defsdmode;
-    QString fifoname;
     QStringList dmopt =
         QStringList::split( QChar( ',' ),
                             QString::fromLatin1( ::getenv( "XDM_MANAGED" ) ) );
     if ( dmopt.isEmpty() || dmopt.first()[0] != QChar( '/' ) ) {
-        fifoname = QString::null;
         maysd = maynuke = false;
         defsdmode = KApplication::ShutdownModeSchedule;
     } else {
-        fifoname = dmopt.first();
+        fifoName = dmopt.first();
         maysd = dmopt.contains( QString::fromLatin1( "maysd" ) ) != 0;
         maynuke = dmopt.contains( QString::fromLatin1( "mayfn" ) ) != 0;
@@ -967,4 +982,7 @@ void KSMServer::shutdown( KApplication::
     if ( logoutConfirmed ) {
 
+        shutdownType = sdtype;
+        shutdownMode = sdmode;
+
         // shall we save the session on logout?
         saveSession = ( config->readEntry( "loginMode", "restorePreviousLogout" ) == \
"restorePreviousLogout" ); @@ -1014,18 +1032,4 @@ void KSMServer::shutdown( \
KApplication::  if ( clients.isEmpty() )
             completeShutdownOrCheckpoint();
-        if ( sdtype != KApplication::ShutdownTypeNone ) {
-            QFile fifo( fifoname );
-            if ( fifo.open( IO_WriteOnly | IO_Raw ) ) {
-                QCString cmd( "shutdown\t" );
-                cmd.append( sdtype == KApplication::ShutdownTypeReboot ?
-                            "reboot\t" : "halt\t" );
-                cmd.append( sdmode == KApplication::ShutdownModeForceNow ?
-                            "forcenow\n" :
-                            sdmode == KApplication::ShutdownModeTryNow ?
-                            "trynow\n" : "schedule\n" );
-                fifo.writeBlock( cmd.data(), cmd.length() );
-                fifo.close();
-            }
-        }
     }
     dialogActive = false;

--- kdebase/ksmserver/server.h  #1.36:1.37
@@ -181,4 +181,8 @@ private:
     int saveType;
 
+    QString fifoName;
+    KApplication::ShutdownType shutdownType;
+    KApplication::ShutdownMode shutdownMode;
+
     bool clean;
     KSMClient* clientInteracting;


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

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