From cb630dde7829e56d55296698f2935f525af7e4c4 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Sat, 29 Jun 2013 13:43:30 -0400 Subject: [PATCH] Cleanups. --- .../gui/team_window/StackTraceView.cpp | 45 ++++++++++--------- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/src/apps/debugger/user_interface/gui/team_window/StackTraceView.cpp b/src/apps/debugger/user_interface/gui/team_window/StackTraceView.cpp index 5850f879ca..65deea348f 100644 --- a/src/apps/debugger/user_interface/gui/team_window/StackTraceView.cpp +++ b/src/apps/debugger/user_interface/gui/team_window/StackTraceView.cpp @@ -157,23 +157,21 @@ StackTraceView::SetStackTrace(StackTrace* stackTrace) { if (stackTrace == fStackTrace) return; - else if (stackTrace == NULL) { - if (fTraceUpdateRunner == NULL) { - BMessage message(MSG_CLEAR_STACK_TRACE); - message.AddPointer("currentTrace", fStackTrace); - fTraceUpdateRunner = new(std::nothrow) BMessageRunner(this, - message, 250000, 1); - if (fTraceUpdateRunner != NULL - && fTraceUpdateRunner->InitCheck() != B_OK) { - delete fTraceUpdateRunner; - fTraceUpdateRunner = NULL; - } + + if (stackTrace == NULL) { + if (fTraceUpdateRunner != NULL) + return; + + BMessage message(MSG_CLEAR_STACK_TRACE); + fTraceUpdateRunner = new(std::nothrow) BMessageRunner(this, + message, 250000, 1); + if (fTraceUpdateRunner != NULL + && fTraceUpdateRunner->InitCheck() == B_OK) { + return; } - } else { - delete fTraceUpdateRunner; - fTraceUpdateRunner = NULL; - _SetStackTrace(stackTrace); } + + _SetStackTrace(stackTrace); } @@ -225,12 +223,8 @@ StackTraceView::MessageReceived(BMessage* message) switch (message->what) { case MSG_CLEAR_STACK_TRACE: { - StackTrace* currentStackTrace; - if (message->FindPointer("currentTrace", - reinterpret_cast(¤tStackTrace)) - == B_OK && currentStackTrace == fStackTrace) { + if (fTraceUpdateRunner != NULL) _SetStackTrace(NULL); - } break; } default: @@ -248,6 +242,14 @@ StackTraceView::TableSelectionChanged(Table* table) if (fListener == NULL) return; + if (fTraceUpdateRunner != NULL) { + // in this instance, ignore the selection change, since the + // stack trace for which a selection change was requested will + // momentarily be invalid. This case is quite unlikely to be hit + // anyways. + return; + } + StackFrame* frame = fFramesTableModel->FrameAt(table->SelectionModel()->RowAt(0)); @@ -284,6 +286,9 @@ StackTraceView::_Init() void StackTraceView::_SetStackTrace(StackTrace* stackTrace) { + delete fTraceUpdateRunner; + fTraceUpdateRunner = NULL; + if (fStackTrace != NULL) fStackTrace->ReleaseReference();