Author: bonefish Date: 2009-11-30 18:14:00 +0100 (Mon, 30 Nov 2009) New Revision: 34388 Changeset: http://dev.haiku-os.org/changeset/34388/haiku Removed: haiku/trunk/headers/private/app/ClipboardPrivate.h Modified: haiku/trunk/src/kits/app/Clipboard.cpp haiku/trunk/src/kits/app/InitTerminateLibBe.cpp haiku/trunk/src/servers/registrar/Registrar.cpp Log: * Give the BClipboard lock a name. * be_clipboard is no longer created at libbe initialization time. The BApplication creates it as done in BeOS. This requires manual initialization in the registrar to avoid a deadlock on shutdown. Modified: haiku/trunk/src/kits/app/Clipboard.cpp =================================================================== --- haiku/trunk/src/kits/app/Clipboard.cpp 2009-11-30 17:11:19 UTC (rev 34387) +++ haiku/trunk/src/kits/app/Clipboard.cpp 2009-11-30 17:14:00 UTC (rev 34388) @@ -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 <ClipboardPrivate.h> - #include <Clipboard.h> + #include <Application.h> #include <RegistrarDefs.h> #include <RosterPrivate.h> @@ -30,6 +29,8 @@ BClipboard::BClipboard(const char *name, bool transient) + : + fLock("clipboard") { if (name != NULL) fName = strdup(name); @@ -91,7 +92,7 @@ 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 @@ 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); -} Modified: haiku/trunk/src/kits/app/InitTerminateLibBe.cpp =================================================================== --- haiku/trunk/src/kits/app/InitTerminateLibBe.cpp 2009-11-30 17:11:19 UTC (rev 34387) +++ haiku/trunk/src/kits/app/InitTerminateLibBe.cpp 2009-11-30 17:14:00 UTC (rev 34388) @@ -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 <stdio.h> #include <stdlib.h> -#include <ClipboardPrivate.h> #include <MessagePrivate.h> #include <RosterPrivate.h> @@ -53,9 +52,6 @@ { 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")); } Modified: haiku/trunk/src/servers/registrar/Registrar.cpp =================================================================== --- haiku/trunk/src/servers/registrar/Registrar.cpp 2009-11-30 17:11:19 UTC (rev 34387) +++ haiku/trunk/src/servers/registrar/Registrar.cpp 2009-11-30 17:14:00 UTC (rev 34388) @@ -3,7 +3,7 @@ * Distributed under the terms of the MIT License. * * Authors: - * Ingo Weinhold, bonefish@xxxxxxxxxxxx + * Ingo Weinhold, ingo_weinhold@xxxxxx */ #include "Registrar.h" @@ -14,6 +14,7 @@ #include <exception> #include <Application.h> +#include <Clipboard.h> #include <Message.h> #include <OS.h> #include <RegistrarDefs.h> @@ -405,6 +406,13 @@ { 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);