diff --git a/headers/private/app/Server.h b/headers/private/app/Server.h index 2c34b330dc..dcd9ced094 100644 --- a/headers/private/app/Server.h +++ b/headers/private/app/Server.h @@ -12,9 +12,12 @@ class BServer : public BApplication { public: - BServer(const char* signature, bool initGUI, status_t* error); + BServer(const char* signature, bool initGUI, status_t *error); status_t InitGUIContext(); + +private: + bool fGUIContextInitialized; }; #endif // _SERVER_H diff --git a/src/kits/app/Server.cpp b/src/kits/app/Server.cpp index e14a6e9e44..af64252d1b 100644 --- a/src/kits/app/Server.cpp +++ b/src/kits/app/Server.cpp @@ -9,14 +9,21 @@ #include // constructor -BServer::BServer(const char* signature, bool initGUI, status_t* error) - : BApplication(signature, initGUI, error) +BServer::BServer(const char* signature, bool initGUI, status_t *error) + : BApplication(signature, initGUI, error), + fGUIContextInitialized(false) { + fGUIContextInitialized = (initGUI && (!error || *error == B_OK)); } // InitGUIContext status_t BServer::InitGUIContext() { - return _InitGUIContext(); + if (fGUIContextInitialized) + return B_OK; + + status_t error = _InitGUIContext(); + fGUIContextInitialized = (error == B_OK); + return error; }