From dca399f4443ebaddbec0350017207d0a48686251 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Fri, 14 Jan 2005 15:33:57 +0000 Subject: [PATCH] Use the BApplication constructor that returns an error code instead of the one that just exit()s on error, so that we can at least print the error. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10728 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/registrar/Registrar.cpp | 22 +++++++++++++++++++--- src/servers/registrar/Registrar.h | 2 +- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/servers/registrar/Registrar.cpp b/src/servers/registrar/Registrar.cpp index b6a2505fbb..6740409111 100644 --- a/src/servers/registrar/Registrar.cpp +++ b/src/servers/registrar/Registrar.cpp @@ -2,6 +2,9 @@ #include "Debug.h" +#include +#include + #include #include #include @@ -31,9 +34,11 @@ static const bigtime_t kRosterSanityEventInterval = 1000000LL; // constructor /*! \brief Creates the registrar application class. + \param error Passed to the BApplication constructor for returning an + error code. */ -Registrar::Registrar() - : BApplication(kRegistrarSignature), +Registrar::Registrar(status_t *error) + : BApplication(kRegistrarSignature, error), fRoster(NULL), fClipboardHandler(NULL), fMIMEManager(NULL), @@ -272,14 +277,25 @@ int main() { FUNCTION_START(); + // rename the main thread rename_thread(find_thread(NULL), kRosterThreadName); + // create and run the registrar application - Registrar *app = new Registrar(); + status_t error; + Registrar *app = new Registrar(&error); + if (error != B_OK) { + fprintf(stderr, "Failed to create the BApplication: %s\n", + strerror(error)); + return 1; + } + PRINT(("app->Run()...\n")); app->Run(); + PRINT(("delete app...\n")); delete app; + FUNCTION_END(); return 0; } diff --git a/src/servers/registrar/Registrar.h b/src/servers/registrar/Registrar.h index 4080801d25..b78a18f4f1 100644 --- a/src/servers/registrar/Registrar.h +++ b/src/servers/registrar/Registrar.h @@ -41,7 +41,7 @@ namespace BPrivate { class Registrar : public BApplication { public: - Registrar(); + Registrar(status_t *error); virtual ~Registrar(); virtual void MessageReceived(BMessage *message);