Cleanups.

This commit is contained in:
Rene Gollent 2013-06-29 13:43:30 -04:00
parent f901b5b7fb
commit cb630dde78

View File

@ -157,23 +157,21 @@ StackTraceView::SetStackTrace(StackTrace* stackTrace)
{ {
if (stackTrace == fStackTrace) if (stackTrace == fStackTrace)
return; return;
else if (stackTrace == NULL) {
if (fTraceUpdateRunner == NULL) { if (stackTrace == NULL) {
if (fTraceUpdateRunner != NULL)
return;
BMessage message(MSG_CLEAR_STACK_TRACE); BMessage message(MSG_CLEAR_STACK_TRACE);
message.AddPointer("currentTrace", fStackTrace);
fTraceUpdateRunner = new(std::nothrow) BMessageRunner(this, fTraceUpdateRunner = new(std::nothrow) BMessageRunner(this,
message, 250000, 1); message, 250000, 1);
if (fTraceUpdateRunner != NULL if (fTraceUpdateRunner != NULL
&& fTraceUpdateRunner->InitCheck() != B_OK) { && fTraceUpdateRunner->InitCheck() == B_OK) {
delete fTraceUpdateRunner; return;
fTraceUpdateRunner = NULL;
} }
} }
} else {
delete fTraceUpdateRunner;
fTraceUpdateRunner = NULL;
_SetStackTrace(stackTrace); _SetStackTrace(stackTrace);
}
} }
@ -225,12 +223,8 @@ StackTraceView::MessageReceived(BMessage* message)
switch (message->what) { switch (message->what) {
case MSG_CLEAR_STACK_TRACE: case MSG_CLEAR_STACK_TRACE:
{ {
StackTrace* currentStackTrace; if (fTraceUpdateRunner != NULL)
if (message->FindPointer("currentTrace",
reinterpret_cast<void**>(&currentStackTrace))
== B_OK && currentStackTrace == fStackTrace) {
_SetStackTrace(NULL); _SetStackTrace(NULL);
}
break; break;
} }
default: default:
@ -248,6 +242,14 @@ StackTraceView::TableSelectionChanged(Table* table)
if (fListener == NULL) if (fListener == NULL)
return; 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 StackFrame* frame
= fFramesTableModel->FrameAt(table->SelectionModel()->RowAt(0)); = fFramesTableModel->FrameAt(table->SelectionModel()->RowAt(0));
@ -284,6 +286,9 @@ StackTraceView::_Init()
void void
StackTraceView::_SetStackTrace(StackTrace* stackTrace) StackTraceView::_SetStackTrace(StackTrace* stackTrace)
{ {
delete fTraceUpdateRunner;
fTraceUpdateRunner = NULL;
if (fStackTrace != NULL) if (fStackTrace != NULL)
fStackTrace->ReleaseReference(); fStackTrace->ReleaseReference();