BServer now remembers whether the GUI context has already been initialized, so that InitGUIContext() can be invoked twice without harm.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13415 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2005-07-03 16:55:27 +00:00
parent a60ea28262
commit 9fac7d6cfc
2 changed files with 14 additions and 4 deletions
+3
View File
@@ -15,6 +15,9 @@ public:
BServer(const char* signature, bool initGUI, status_t *error); BServer(const char* signature, bool initGUI, status_t *error);
status_t InitGUIContext(); status_t InitGUIContext();
private:
bool fGUIContextInitialized;
}; };
#endif // _SERVER_H #endif // _SERVER_H
+9 -2
View File
@@ -10,13 +10,20 @@
// constructor // constructor
BServer::BServer(const char* signature, bool initGUI, status_t *error) BServer::BServer(const char* signature, bool initGUI, status_t *error)
: BApplication(signature, initGUI, error) : BApplication(signature, initGUI, error),
fGUIContextInitialized(false)
{ {
fGUIContextInitialized = (initGUI && (!error || *error == B_OK));
} }
// InitGUIContext // InitGUIContext
status_t status_t
BServer::InitGUIContext() BServer::InitGUIContext()
{ {
return _InitGUIContext(); if (fGUIContextInitialized)
return B_OK;
status_t error = _InitGUIContext();
fGUIContextInitialized = (error == B_OK);
return error;
} }