From f47952f72339c14c443a793b54802ebd084626ef Mon Sep 17 00:00:00 2001 From: Clemens Zeidler Date: Sun, 29 May 2011 22:43:50 +0000 Subject: [PATCH] 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. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41821 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/app/Looper.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/kits/app/Looper.cpp b/src/kits/app/Looper.cpp index 61d0471545..9cd9e6e984 100644 --- a/src/kits/app/Looper.cpp +++ b/src/kits/app/Looper.cpp @@ -1206,6 +1206,10 @@ void 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 @@ -1216,12 +1220,9 @@ BLooper::_QuitRequested(BMessage* message) || (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(); }