From fc48ae3f8024a729a738657e1464ab0394737901 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Mon, 20 Aug 2018 16:42:55 -0400 Subject: [PATCH] Debugger: Fix #14375, #12343. TeamDebugger: - When a job is aborted, instead of calling into the user interface directly to reset the status message, post a message to do so. Also, only post the message if we aren't already in a terminating state. Otherwise, if jobs were still running while the team debugger is executing its destructor, it would attempt to make calls to the already destroyed user interface. This bug has likely been with us for quite some time, but was hidden by incorrect ref counting in the past (see #12343). --- headers/private/debugger/MessageCodes.h | 3 ++- src/kits/debugger/controllers/TeamDebugger.cpp | 10 ++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/headers/private/debugger/MessageCodes.h b/headers/private/debugger/MessageCodes.h index 5a22f1f0ec..c092bd707a 100644 --- a/headers/private/debugger/MessageCodes.h +++ b/headers/private/debugger/MessageCodes.h @@ -60,7 +60,8 @@ enum { MSG_GENERATE_DEBUG_REPORT = 'gdrp', MSG_DEBUG_INFO_NEEDS_USER_INPUT = 'dnui', - MSG_USER_INTERFACE_FILE_CHOSEN = 'uifc' + MSG_USER_INTERFACE_FILE_CHOSEN = 'uifc', + MSG_RESET_USER_BACKGROUND_STATUS = 'rubs' }; diff --git a/src/kits/debugger/controllers/TeamDebugger.cpp b/src/kits/debugger/controllers/TeamDebugger.cpp index 49f152e90c..61465ee8e0 100644 --- a/src/kits/debugger/controllers/TeamDebugger.cpp +++ b/src/kits/debugger/controllers/TeamDebugger.cpp @@ -963,6 +963,12 @@ TeamDebugger::MessageReceived(BMessage* message) break; } + case MSG_RESET_USER_BACKGROUND_STATUS: + { + fUserInterface->NotifyBackgroundWorkStatus("Ready."); + break; + } + default: BLooper::MessageReceived(message); break; @@ -2546,8 +2552,8 @@ TeamDebugger::_NotifyUser(const char* title, const char* text,...) void TeamDebugger::_ResetUserBackgroundStatusIfNeeded() { - if (!fWorker->HasPendingJobs()) - fUserInterface->NotifyBackgroundWorkStatus("Ready."); + if (!fTerminating && !fWorker->HasPendingJobs()) + PostMessage(MSG_RESET_USER_BACKGROUND_STATUS); }