* Create and store a messenger to the team window at creation time. Use said messenger to correctly resolve the TODO previously attempted in r42066.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42075 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Rene Gollent 2011-06-09 19:39:26 +00:00
parent 87aa57e88e
commit b697e03121
2 changed files with 8 additions and 6 deletions

View File

@ -14,13 +14,15 @@
GraphicalUserInterface::GraphicalUserInterface()
:
fTeamWindow(NULL)
fTeamWindow(NULL),
fTeamWindowMessenger(NULL)
{
}
GraphicalUserInterface::~GraphicalUserInterface()
{
delete fTeamWindowMessenger;
}
@ -29,6 +31,7 @@ GraphicalUserInterface::Init(Team* team, UserInterfaceListener* listener)
{
try {
fTeamWindow = TeamWindow::Create(team, listener);
fTeamWindowMessenger = new BMessenger(fTeamWindow);
} catch (...) {
// TODO: Notify the user!
ERROR("Error: Failed to create team window!\n");
@ -50,11 +53,8 @@ void
GraphicalUserInterface::Terminate()
{
// quit window
if (fTeamWindow != NULL) {
BMessenger messenger(fTeamWindow);
if (messenger.IsValid() && messenger.LockTarget())
fTeamWindow->Quit();
}
if (fTeamWindowMessenger && fTeamWindowMessenger->LockTarget())
fTeamWindow->Quit();
}

View File

@ -9,6 +9,7 @@
#include "UserInterface.h"
class BMessenger;
class TeamWindow;
@ -33,6 +34,7 @@ public:
private:
TeamWindow* fTeamWindow;
BMessenger* fTeamWindowMessenger;
};