* 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.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34388 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2009-11-30 17:14:00 +00:00
parent 3c0c94f81c
commit 4701b640d9
4 changed files with 15 additions and 36 deletions

View File

@ -1,12 +0,0 @@
// ClipboardPrivate.h
#ifndef _CLIPBOARD_PRIVATE_H
#define _CLIPBOARD_PRIVATE_H
namespace BPrivate {
void init_clipboard();
};
#endif // _CLIPBOARD_PRIVATE_H

View File

@ -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 @@ 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);
}

View File

@ -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 @@ 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"));
}

View File

@ -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 <exception>
#include <Application.h>
#include <Clipboard.h>
#include <Message.h>
#include <OS.h>
#include <RegistrarDefs.h>
@ -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);