Author: czeidler Date: 2011-05-30 00:43:50 +0200 (Mon, 30 May 2011) New Revision: 41821 Changeset: https://dev.haiku-os.org/changeset/41821 Ticket: https://dev.haiku-os.org/ticket/7559 Modified: haiku/trunk/src/kits/app/Looper.cpp Log: If the looper is B_QUIT_REQUESTED synchronously. First quit and then send the reply message. Please check if this is the correct semantics. I expected that the looper is dead when SendMessage returned. This should fix #7559 where the looper destructor has to be called before continuing the cleanup. Modified: haiku/trunk/src/kits/app/Looper.cpp =================================================================== --- haiku/trunk/src/kits/app/Looper.cpp 2011-05-29 22:38:35 UTC (rev 41820) +++ haiku/trunk/src/kits/app/Looper.cpp 2011-05-29 22:43:50 UTC (rev 41821) @@ -1206,7 +1206,11 @@ BLooper::_QuitRequested(BMessage* message) { bool isQuitting = QuitRequested(); + int32 thread = fThread; + if (isQuitting) + Quit(); + // 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 @@ -1216,12 +1220,9 @@ || (message->FindBool("_shutdown_", &shutdown) == B_OK && shutdown)) { BMessage replyMsg(B_REPLY); replyMsg.AddBool("result", isQuitting); - replyMsg.AddInt32("thread", fThread); + replyMsg.AddInt32("thread", thread); message->SendReply(&replyMsg); } - - if (isQuitting) - Quit(); }