From 4b74bbf2766cc70bc486fc929cc74944c15ca4f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Wed, 13 May 2009 09:13:26 +0000 Subject: [PATCH] * Make the shutdown request no longer prevent apps from being launched. Now they only cannot be launched anymore once you acknowledge that request. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30744 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/registrar/ShutdownProcess.cpp | 41 +++++++++++++---------- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/src/servers/registrar/ShutdownProcess.cpp b/src/servers/registrar/ShutdownProcess.cpp index 0e9bac6d8b..f000719fca 100644 --- a/src/servers/registrar/ShutdownProcess.cpp +++ b/src/servers/registrar/ShutdownProcess.cpp @@ -683,10 +683,7 @@ ShutdownProcess::Init(BMessage* request) RETURN_ERROR(fInternalEventSemaphore); // init the app server connection - fHasGUI = (Registrar::App()->InitGUIContext() == B_OK); - - // tell TRoster not to accept new applications anymore - fRoster->SetShuttingDown(true); + fHasGUI = Registrar::App()->InitGUIContext() == B_OK; // start watching application quits status_t error = fRoster->AddWatcher(this); @@ -695,18 +692,6 @@ ShutdownProcess::Init(BMessage* request) RETURN_ERROR(error); } - // get a list of all applications to shut down and sort them - error = fRoster->GetShutdownApps(fUserApps, fSystemApps, fBackgroundApps, - fVitalSystemApps); - if (error != B_OK) { - fRoster->RemoveWatcher(this); - fRoster->SetShuttingDown(false); - RETURN_ERROR(error); - } - - fUserApps.Sort(&inverse_compare_by_registration_time); - fSystemApps.Sort(&inverse_compare_by_registration_time); - // start the worker thread fWorker = spawn_thread(_WorkerEntry, "shutdown worker", B_NORMAL_PRIORITY, this); @@ -1268,6 +1253,26 @@ ShutdownProcess::_WorkerDoShutdown() throw_error(B_SHUTDOWN_CANCELLED); } + // tell TRoster not to accept new applications anymore + fRoster->SetShuttingDown(true); + + fWorkerLock.Lock(); + + // get a list of all applications to shut down and sort them + status_t status = fRoster->GetShutdownApps(fUserApps, fSystemApps, + fBackgroundApps, fVitalSystemApps); + if (status != B_OK) { + fWorkerLock.Unlock(); + fRoster->RemoveWatcher(this); + fRoster->SetShuttingDown(false); + return; + } + + fUserApps.Sort(&inverse_compare_by_registration_time); + fSystemApps.Sort(&inverse_compare_by_registration_time); + + fWorkerLock.Unlock(); + // make the shutdown window ready and show it _InitShutdownWindow(); _SetShutdownWindowCurrentApp(-1); @@ -1321,8 +1326,8 @@ ShutdownProcess::_WorkerDoShutdown() do { team_id team; int32 phase; - status_t error = _GetNextEvent(event, team, phase, true); - if (error != B_OK) + status = _GetNextEvent(event, team, phase, true); + if (status != B_OK) break; } while (event != REBOOT_SYSTEM_EVENT);