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