Version: unknown (using KDE 3.3.2, Mandrake Linux Cooker i586 - Cooker) Compiler: gcc version 3.4.3 (Mandrakelinux 10.2 3.4.3-3mdk) OS: Linux (i686) release 2.6.10-3mdkcustom Hey there :) I realize this is an extreme situation (as in it would happen very rarely), but it might be easy to prevent, so here goes anyway: I just started up my laptop using a battery I thought was fully charged. I have klaptop setup to shut down the computer when battery level drops to 5 minutes. As it turned out, the battery I used was already drained, so while KDE was starting up, I saw the battery warning box telling me that there was 1 minute left on the battery, and the shutdown process started. Okay, so what happened was that the desktop I had the last time I shut down the puter myself had a bunch of windows open - three konquerors with a number of tabs, and kdevelop with a project I'm working on. The desktop was never restored before the computer started shutting down because of the low battery level, and the next time I booted the puter with a fresh battery, I was presented with an empty desktop. The computer did finish shutting down properly, btw. It seems that since my old desktop hadn't been restored when the shutdown process started, KDE chose to save the desktop as it was, i.e. with nothing open (since nothing had been restored yet). I was thinking, not actually knowing the KDE code, it might be trivial to put in an "if (kde boot not 100% complete) { skip save desktop } else { save desktop }"? I know you're busy, and that there's a low chance of this situation occurring for the average user, but what the heck, you never know, right? ;) Thanks for the desktop making Explorer officially "not ready for the desktop". :) Daniel.
SVN commit 531614 by lunakl: Don't initiate shutdown before startup is fully completed. BUG: 100935 M +1 -0 server.cpp M +6 -0 server.h M +21 -1 shutdown.cpp --- trunk/KDE/kdebase/workspace/ksmserver/server.cpp #531613:531614 @@ -598,6 +598,7 @@ connect( &knotifyTimeoutTimer, SIGNAL( timeout()), SLOT( knotifyTimeout())); connect( &startupSuspendTimeoutTimer, SIGNAL( timeout()), SLOT( startupSuspendTimeout())); + connect( &pendingShutdown, SIGNAL( timeout()), SLOT( pendingShutdownTimeout())); only_local = _only_local; #ifdef HAVE__ICETRANSNOLISTEN --- trunk/KDE/kdebase/workspace/ksmserver/server.h #531613:531614 @@ -20,6 +20,7 @@ #include <QTime> #include <qmap.h> #include <dcopobject.h> +#include <kworkspace.h> #include "server2.h" #include "KSMServerInterface.h" @@ -103,6 +104,7 @@ void knotifyTimeout(); void kcmPhase1Timeout(); void kcmPhase2Timeout(); + void pendingShutdownTimeout(); void autoStart0(); void autoStart1(); @@ -187,6 +189,10 @@ QTimer startupSuspendTimeoutTimer; bool waitAutoStart2; bool waitKcmInit2; + QTimer pendingShutdown; + KWorkSpace::ShutdownConfirm pendingShutdown_confirm; + KWorkSpace::ShutdownType pendingShutdown_sdtype; + KWorkSpace::ShutdownMode pendingShutdown_sdmode; // ksplash interface void upAndRunning( const QString& msg ); --- trunk/KDE/kdebase/workspace/ksmserver/shutdown.cpp #531613:531614 @@ -98,8 +98,23 @@ void KSMServer::shutdown( KWorkSpace::ShutdownConfirm confirm, KWorkSpace::ShutdownType sdtype, KWorkSpace::ShutdownMode sdmode ) { - if ( state != Idle || dialogActive ) + pendingShutdown.stop(); + if( dialogActive ) return; + if( state >= Shutdown ) // already performing shutdown + return; + if( state != Idle ) // performing startup + { + // perform shutdown as soon as startup is finished, in order to avoid saving partial session + if( !pendingShutdown.isActive()) + { + pendingShutdown.start( 1000 ); + pendingShutdown_confirm = confirm; + pendingShutdown_sdtype = sdtype; + pendingShutdown_sdmode = sdmode; + } + return; + } KConfig *config = KGlobal::config(); config->reparseConfiguration(); // config may have changed in the KControl module @@ -195,6 +210,11 @@ dialogActive = false; } +void KSMServer::pendingShutdownTimeout() +{ + shutdown( pendingShutdown_confirm, pendingShutdown_sdtype, pendingShutdown_sdmode ); +} + void KSMServer::saveCurrentSession() { if ( state != Idle || dialogActive )
You need to log in before you can comment on or make changes to this bug.