* 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:
@@ -1,12 +0,0 @@
|
|||||||
// ClipboardPrivate.h
|
|
||||||
|
|
||||||
#ifndef _CLIPBOARD_PRIVATE_H
|
|
||||||
#define _CLIPBOARD_PRIVATE_H
|
|
||||||
|
|
||||||
namespace BPrivate {
|
|
||||||
|
|
||||||
void init_clipboard();
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // _CLIPBOARD_PRIVATE_H
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2001-2007, Haiku.
|
* Copyright 2001-2009, Haiku Inc.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -7,9 +7,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <ClipboardPrivate.h>
|
|
||||||
|
|
||||||
#include <Clipboard.h>
|
#include <Clipboard.h>
|
||||||
|
|
||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
#include <RegistrarDefs.h>
|
#include <RegistrarDefs.h>
|
||||||
#include <RosterPrivate.h>
|
#include <RosterPrivate.h>
|
||||||
@@ -30,6 +29,8 @@ using namespace BPrivate;
|
|||||||
|
|
||||||
|
|
||||||
BClipboard::BClipboard(const char *name, bool transient)
|
BClipboard::BClipboard(const char *name, bool transient)
|
||||||
|
:
|
||||||
|
fLock("clipboard")
|
||||||
{
|
{
|
||||||
if (name != NULL)
|
if (name != NULL)
|
||||||
fName = strdup(name);
|
fName = strdup(name);
|
||||||
@@ -91,7 +92,7 @@ BClipboard::LocalCount() const
|
|||||||
value directly from the system service managing the clipboards, so it is
|
value directly from the system service managing the clipboards, so it is
|
||||||
more expensive, but more up-to-date than LocalCount(), which returns a
|
more expensive, but more up-to-date than LocalCount(), which returns a
|
||||||
locally cached value.
|
locally cached value.
|
||||||
|
|
||||||
\return The number of commits to the clipboard.
|
\return The number of commits to the clipboard.
|
||||||
*/
|
*/
|
||||||
uint32
|
uint32
|
||||||
@@ -291,17 +292,3 @@ BClipboard::_DownloadFromSystem(bool force)
|
|||||||
|
|
||||||
return B_ERROR;
|
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);
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2001-2005, Haiku.
|
* Copyright 2001-2009, Haiku.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -12,7 +12,6 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <ClipboardPrivate.h>
|
|
||||||
#include <MessagePrivate.h>
|
#include <MessagePrivate.h>
|
||||||
#include <RosterPrivate.h>
|
#include <RosterPrivate.h>
|
||||||
|
|
||||||
@@ -53,9 +52,6 @@ initialize_after()
|
|||||||
{
|
{
|
||||||
DBG(OUT("initialize_after()\n"));
|
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"));
|
DBG(OUT("initialize_after() done\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
* Ingo Weinhold, [email protected]
|
* Ingo Weinhold, [email protected]
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "Registrar.h"
|
#include "Registrar.h"
|
||||||
@@ -14,6 +14,7 @@
|
|||||||
#include <exception>
|
#include <exception>
|
||||||
|
|
||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
|
#include <Clipboard.h>
|
||||||
#include <Message.h>
|
#include <Message.h>
|
||||||
#include <OS.h>
|
#include <OS.h>
|
||||||
#include <RegistrarDefs.h>
|
#include <RegistrarDefs.h>
|
||||||
@@ -405,6 +406,13 @@ main()
|
|||||||
{
|
{
|
||||||
FUNCTION_START();
|
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
|
// create and run the registrar application
|
||||||
status_t error;
|
status_t error;
|
||||||
Registrar *app = new Registrar(&error);
|
Registrar *app = new Registrar(&error);
|
||||||
|
|||||||
Reference in New Issue
Block a user