Removed the handling of B_QUIT_REQUESTED in BApplication::DispatchMessage().

It's already done in BLooper. Now we additionally send a reply to it, when
the message comes from the registrar on shutdown.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13419 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2005-07-04 10:30:38 +00:00
parent 1a02bff863
commit 2f903d78cf
2 changed files with 7 additions and 22 deletions
-6
View File
@@ -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;
+7 -16
View File
@@ -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);