diff --git a/src/kits/app/Application.cpp b/src/kits/app/Application.cpp index f3ead67b32..39540b331a 100644 --- a/src/kits/app/Application.cpp +++ b/src/kits/app/Application.cpp @@ -856,12 +856,6 @@ BApplication::DispatchMessage(BMessage *message, BHandler *handler) AboutRequested(); break; - case B_QUIT_REQUESTED: - DBG(message->PrintToStream()); - if (QuitRequested()) - Quit(); - break; - case B_PULSE: Pulse(); break; diff --git a/src/kits/app/Looper.cpp b/src/kits/app/Looper.cpp index 59e8908314..666bdd2077 100644 --- a/src/kits/app/Looper.cpp +++ b/src/kits/app/Looper.cpp @@ -1331,24 +1331,15 @@ BLooper::task_looper() void BLooper::do_quit_requested(BMessage *msg) { - /** @note - I couldn't figure out why do_quit_requested() was necessary; why not - just call Quit()? Then, while writing the PostMessage() code, I - realized that the sender of the B_QUIT_REQUESTED message just might - be waiting for a reply. A quick test, and yes, we get a reply - which consists of: - what: B_REPLY - "result" (bool) return of QuitRequested() - "thread" (int32) the looper's thread id - - While Quit() could use fLastMessage, it makes more sense that - do_quit_requested() would handle it since it gets passed the - message. - */ - bool isQuitting = QuitRequested(); - if (msg->IsSourceWaiting()) { + // We send a reply to the sender, when they're waiting for a reply or + // if the request message contains a boolean "_shutdown_" field with value + // true. In the latter case the message came from the registrar, asking + // the application to shut down. + bool shutdown; + if (msg->IsSourceWaiting() + || (msg->FindBool("_shutdown_", &shutdown) == B_OK && shutdown)) { BMessage ReplyMsg(B_REPLY); ReplyMsg.AddBool("result", isQuitting); ReplyMsg.AddInt32("thread", fTaskID);