diff --git a/headers/private/app/ClipboardPrivate.h b/headers/private/app/ClipboardPrivate.h deleted file mode 100644 index 0e5125445a..0000000000 --- a/headers/private/app/ClipboardPrivate.h +++ /dev/null @@ -1,12 +0,0 @@ -// ClipboardPrivate.h - -#ifndef _CLIPBOARD_PRIVATE_H -#define _CLIPBOARD_PRIVATE_H - -namespace BPrivate { - -void init_clipboard(); - -}; - -#endif // _CLIPBOARD_PRIVATE_H diff --git a/src/kits/app/Clipboard.cpp b/src/kits/app/Clipboard.cpp index 17e8109b6c..ba3f8bed16 100644 --- a/src/kits/app/Clipboard.cpp +++ b/src/kits/app/Clipboard.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2001-2007, Haiku. + * Copyright 2001-2009, Haiku Inc. * Distributed under the terms of the MIT License. * * Authors: @@ -7,9 +7,8 @@ */ -#include - #include + #include #include #include @@ -30,6 +29,8 @@ using namespace BPrivate; BClipboard::BClipboard(const char *name, bool transient) + : + fLock("clipboard") { if (name != NULL) fName = strdup(name); @@ -91,7 +92,7 @@ BClipboard::LocalCount() const value directly from the system service managing the clipboards, so it is more expensive, but more up-to-date than LocalCount(), which returns a locally cached value. - + \return The number of commits to the clipboard. */ uint32 @@ -291,17 +292,3 @@ BClipboard::_DownloadFromSystem(bool force) return B_ERROR; } - - -// #pragma mark - - - -/*! \brief Initializes the global \c be_clipboard. - - Invoked at libbe initialization time. -*/ -void -BPrivate::init_clipboard() -{ - be_clipboard = new BClipboard(NULL); -} diff --git a/src/kits/app/InitTerminateLibBe.cpp b/src/kits/app/InitTerminateLibBe.cpp index 8f8314cecd..1d4b527959 100644 --- a/src/kits/app/InitTerminateLibBe.cpp +++ b/src/kits/app/InitTerminateLibBe.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2001-2005, Haiku. + * Copyright 2001-2009, Haiku. * Distributed under the terms of the MIT License. * * Authors: @@ -12,7 +12,6 @@ #include #include -#include #include #include @@ -53,9 +52,6 @@ initialize_after() { DBG(OUT("initialize_after()\n")); - BPrivate::init_clipboard(); - // needs to send a message, and that requires gDefaultTokens to be initialized - DBG(OUT("initialize_after() done\n")); } diff --git a/src/servers/registrar/Registrar.cpp b/src/servers/registrar/Registrar.cpp index de1a04f8af..cb6cfb5a56 100644 --- a/src/servers/registrar/Registrar.cpp +++ b/src/servers/registrar/Registrar.cpp @@ -3,7 +3,7 @@ * Distributed under the terms of the MIT License. * * Authors: - * Ingo Weinhold, bonefish@users.sf.net + * Ingo Weinhold, ingo_weinhold@gmx.de */ #include "Registrar.h" @@ -14,6 +14,7 @@ #include #include +#include #include #include #include @@ -405,6 +406,13 @@ main() { FUNCTION_START(); + // Create the global be_clipboard manually -- it will not work, since it + // wants to talk to the registrar in its constructor, but it doesn't have + // to and we would otherwise deadlock when initializing our GUI in the + // app thread. + be_clipboard = new BClipboard(NULL); + + // create and run the registrar application status_t error; Registrar *app = new Registrar(&error);