Fixed the application quit mechanism. Due to the two levels of asynchronous

message sending the main thread exit()ed before the team debugger could process
its quit message. We're no longer taking the detour via Debugger when quitting
a window. The team debugger just quits and synchronously notifies the
application, which in turn waits until all team debugger threads have gone.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31219 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2009-06-24 00:16:22 +00:00
parent fef6a27d78
commit 719f89b06e
4 changed files with 80 additions and 47 deletions
+16 -21
View File
@@ -11,7 +11,6 @@
#include <new>
#include <Alert.h>
#include <Application.h>
#include <Message.h>
#include <AutoLocker.h>
@@ -26,9 +25,10 @@
#include "TeamDebugModel.h"
TeamDebugger::TeamDebugger()
TeamDebugger::TeamDebugger(Listener* listener)
:
BLooper("team debugger"),
fListener(listener),
fTeam(NULL),
fDebugModel(NULL),
fTeamID(-1),
@@ -63,6 +63,8 @@ TeamDebugger::~TeamDebugger()
delete fWorker;
delete fDebugModel;
delete fTeam;
fListener->TeamDebuggerQuit(this);
}
@@ -188,14 +190,6 @@ TeamDebugger::Init(team_id teamID, thread_id threadID, bool stopInMain)
}
void
TeamDebugger::DeleteSelf()
{
Lock();
Quit();
}
void
TeamDebugger::MessageReceived(BMessage* message)
{
@@ -323,13 +317,9 @@ TeamDebugger::ClearBreakpointRequested(target_addr_t address)
bool
TeamDebugger::TeamWindowQuitRequested(TeamWindow* window)
{
// TODO: Is this what shall happen?
if (!fTeam->Lock())
return true;
AutoLocker< ::Team> locker(fTeam);
BString name(fTeam->Name());
fTeam->Unlock();
locker.Unlock();
BString message;
message << "What shall be done about the debugged team '";
@@ -354,14 +344,11 @@ TeamDebugger::TeamWindowQuitRequested(TeamWindow* window)
case 1:
return false;
case 2:
// Detach from the team and resume and stopped threads. Seems to be
// the default action anyways.
// Detach from the team and resume and stopped threads.
break;
}
BMessage quitMessage(MSG_DEBUGGER_QUIT_REQUESTED);
quitMessage.AddPointer("debugger", this);
be_app->PostMessage(&quitMessage);
PostMessage(B_QUIT_REQUESTED);
return true;
}
@@ -891,3 +878,11 @@ TeamDebugger::_NotifyUser(const char* title, const char* text,...)
// create it and don't care anymore. Maybe an error window, which can
// display a list of errors would be the better choice.
}
// #pragma mark - Listener
TeamDebugger::Listener::~Listener()
{
}