Commit 5f48e2cd authored by Allison Karlitskaya's avatar Allison Karlitskaya

GDBus: switch to struct-embedded GMutex and GCond

Now that we have those, we should use them.

https://bugzilla.gnome.org/show_bug.cgi?id=660739
parent e03db427
......@@ -280,7 +280,7 @@ _g_strv_has_string (const gchar* const *haystack,
#else
// TODO: for some reason this doesn't work on Windows
#define CONNECTION_ENSURE_LOCK(obj) do { \
if (G_UNLIKELY (g_mutex_trylock((obj)->lock))) \
if (G_UNLIKELY (g_mutex_trylock(&(obj)->lock))) \
{ \
g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
"CONNECTION_ENSURE_LOCK: GDBusConnection object lock is not locked"); \
......@@ -289,11 +289,11 @@ _g_strv_has_string (const gchar* const *haystack,
#endif
#define CONNECTION_LOCK(obj) do { \
g_mutex_lock ((obj)->lock); \
g_mutex_lock (&(obj)->lock); \
} while (FALSE)
#define CONNECTION_UNLOCK(obj) do { \
g_mutex_unlock ((obj)->lock); \
g_mutex_unlock (&(obj)->lock); \
} while (FALSE)
/**
......@@ -314,12 +314,12 @@ struct _GDBusConnection
/* ------------------------------------------------------------------------ */
/* object-wide lock */
GMutex *lock;
GMutex lock;
/* A lock used in the init() method of the GInitable interface - see comments
* in initable_init() for why a separate lock is needed
*/
GMutex *init_lock;
GMutex init_lock;
/* Set (by loading the contents of /var/lib/dbus/machine-id) the first time
* someone calls org.freedesktop.DBus.GetMachineId()
......@@ -541,8 +541,8 @@ g_dbus_connection_finalize (GObject *object)
g_free (connection->machine_id);
g_mutex_free (connection->init_lock);
g_mutex_free (connection->lock);
g_mutex_clear (&connection->init_lock);
g_mutex_clear (&connection->lock);
G_OBJECT_CLASS (g_dbus_connection_parent_class)->finalize (object);
}
......@@ -903,8 +903,8 @@ g_dbus_connection_class_init (GDBusConnectionClass *klass)
static void
g_dbus_connection_init (GDBusConnection *connection)
{
connection->lock = g_mutex_new ();
connection->init_lock = g_mutex_new ();
g_mutex_init (&connection->lock);
g_mutex_init (&connection->init_lock);
connection->map_method_serial_to_send_message_data = g_hash_table_new (g_direct_hash, g_direct_equal);
......@@ -2271,7 +2271,7 @@ initable_init (GInitable *initable,
* callbacks above needs the lock during initialization (for message
* bus connections we do a synchronous Hello() call on the bus).
*/
g_mutex_lock (connection->init_lock);
g_mutex_lock (&connection->init_lock);
ret = FALSE;
......@@ -2438,7 +2438,7 @@ initable_init (GInitable *initable,
g_propagate_error (error, g_error_copy (connection->initialization_error));
}
g_mutex_unlock (connection->init_lock);
g_mutex_unlock (&connection->init_lock);
return ret;
}
......
......@@ -44,7 +44,7 @@
struct _GDBusInterfaceSkeletonPrivate
{
GMutex *lock;
GMutex lock;
GDBusObject *object;
GDBusInterfaceSkeletonFlags flags;
......@@ -89,7 +89,7 @@ g_dbus_interface_skeleton_finalize (GObject *object)
if (interface->priv->object != NULL)
g_object_remove_weak_pointer (G_OBJECT (interface->priv->object), (gpointer *) &interface->priv->object);
g_mutex_free (interface->priv->lock);
g_mutex_clear (&interface->priv->lock);
G_OBJECT_CLASS (g_dbus_interface_skeleton_parent_class)->finalize (object);
}
......@@ -233,7 +233,7 @@ static void
g_dbus_interface_skeleton_init (GDBusInterfaceSkeleton *interface)
{
interface->priv = G_TYPE_INSTANCE_GET_PRIVATE (interface, G_TYPE_DBUS_INTERFACE_SKELETON, GDBusInterfaceSkeletonPrivate);
interface->priv->lock = g_mutex_new ();
g_mutex_init (&interface->priv->lock);
}
/* ---------------------------------------------------------------------------------------------------- */
......@@ -270,16 +270,16 @@ g_dbus_interface_skeleton_set_flags (GDBusInterfaceSkeleton *interface_,
GDBusInterfaceSkeletonFlags flags)
{
g_return_if_fail (G_IS_DBUS_INTERFACE_SKELETON (interface_));
g_mutex_lock (interface_->priv->lock);
g_mutex_lock (&interface_->priv->lock);
if (interface_->priv->flags != flags)
{
interface_->priv->flags = flags;
g_mutex_unlock (interface_->priv->lock);
g_mutex_unlock (&interface_->priv->lock);
g_object_notify (G_OBJECT (interface_), "g-flags");
}
else
{
g_mutex_unlock (interface_->priv->lock);
g_mutex_unlock (&interface_->priv->lock);
}
}
......@@ -381,9 +381,9 @@ g_dbus_interface_skeleton_get_object (GDBusInterface *interface_)
{
GDBusInterfaceSkeleton *interface = G_DBUS_INTERFACE_SKELETON (interface_);
GDBusObject *ret;
g_mutex_lock (interface->priv->lock);
g_mutex_lock (&interface->priv->lock);
ret = interface->priv->object;
g_mutex_unlock (interface->priv->lock);
g_mutex_unlock (&interface->priv->lock);
return ret;
}
......@@ -392,13 +392,13 @@ g_dbus_interface_skeleton_set_object (GDBusInterface *interface_,
GDBusObject *object)
{
GDBusInterfaceSkeleton *interface = G_DBUS_INTERFACE_SKELETON (interface_);
g_mutex_lock (interface->priv->lock);
g_mutex_lock (&interface->priv->lock);
if (interface->priv->object != NULL)
g_object_remove_weak_pointer (G_OBJECT (interface->priv->object), (gpointer *) &interface->priv->object);
interface->priv->object = object;
if (object != NULL)
g_object_add_weak_pointer (G_OBJECT (interface->priv->object), (gpointer *) &interface->priv->object);
g_mutex_unlock (interface->priv->lock);
g_mutex_unlock (&interface->priv->lock);
}
static void
......@@ -463,12 +463,12 @@ dispatch_in_thread_func (GIOSchedulerJob *job,
GDBusObject *object;
gboolean authorized;
g_mutex_lock (data->interface->priv->lock);
g_mutex_lock (&data->interface->priv->lock);
flags = data->interface->priv->flags;
object = data->interface->priv->object;
if (object != NULL)
g_object_ref (object);
g_mutex_unlock (data->interface->priv->lock);
g_mutex_unlock (&data->interface->priv->lock);
/* first check on the enclosing object (if any), then the interface */
authorized = TRUE;
......@@ -542,12 +542,12 @@ g_dbus_interface_method_dispatch_helper (GDBusInterfaceSkeleton *interface
g_return_if_fail (method_call_func != NULL);
g_return_if_fail (G_IS_DBUS_METHOD_INVOCATION (invocation));
g_mutex_lock (interface->priv->lock);
g_mutex_lock (&interface->priv->lock);
flags = interface->priv->flags;
object = interface->priv->object;
if (object != NULL)
g_object_ref (object);
g_mutex_unlock (interface->priv->lock);
g_mutex_unlock (&interface->priv->lock);
/* optimization for the common case where
*
......@@ -636,9 +636,9 @@ g_dbus_interface_skeleton_get_connection (GDBusInterfaceSkeleton *interface_)
{
GDBusConnection *ret;
g_return_val_if_fail (G_IS_DBUS_INTERFACE_SKELETON (interface_), NULL);
g_mutex_lock (interface_->priv->lock);
g_mutex_lock (&interface_->priv->lock);
ret = interface_->priv->connection;
g_mutex_unlock (interface_->priv->lock);
g_mutex_unlock (&interface_->priv->lock);
return ret;
}
......@@ -658,9 +658,9 @@ g_dbus_interface_skeleton_get_object_path (GDBusInterfaceSkeleton *interface_)
{
const gchar *ret;
g_return_val_if_fail (G_IS_DBUS_INTERFACE_SKELETON (interface_), NULL);
g_mutex_lock (interface_->priv->lock);
g_mutex_lock (&interface_->priv->lock);
ret = interface_->priv->object_path;
g_mutex_unlock (interface_->priv->lock);
g_mutex_unlock (&interface_->priv->lock);
return ret;
}
......@@ -693,7 +693,7 @@ g_dbus_interface_skeleton_export (GDBusInterfaceSkeleton *interface_,
g_return_val_if_fail (g_variant_is_object_path (object_path), 0);
g_return_val_if_fail (error == NULL || *error == NULL, 0);
g_mutex_lock (interface_->priv->lock);
g_mutex_lock (&interface_->priv->lock);
ret = FALSE;
if (interface_->priv->registration_id > 0)
......@@ -731,7 +731,7 @@ g_dbus_interface_skeleton_export (GDBusInterfaceSkeleton *interface_,
ret = TRUE;
out:
g_mutex_unlock (interface_->priv->lock);
g_mutex_unlock (&interface_->priv->lock);
return ret;
}
......@@ -750,7 +750,7 @@ g_dbus_interface_skeleton_unexport (GDBusInterfaceSkeleton *interface_)
g_return_if_fail (G_IS_DBUS_INTERFACE_SKELETON (interface_));
g_return_if_fail (interface_->priv->registration_id > 0);
g_mutex_lock (interface_->priv->lock);
g_mutex_lock (&interface_->priv->lock);
g_assert (interface_->priv->connection != NULL);
g_assert (interface_->priv->object_path != NULL);
......@@ -766,7 +766,7 @@ g_dbus_interface_skeleton_unexport (GDBusInterfaceSkeleton *interface_)
interface_->priv->hooked_vtable = NULL;
interface_->priv->registration_id = 0;
g_mutex_unlock (interface_->priv->lock);
g_mutex_unlock (&interface_->priv->lock);
}
/* ---------------------------------------------------------------------------------------------------- */
......@@ -125,7 +125,7 @@
struct _GDBusObjectManagerClientPrivate
{
GMutex *lock;
GMutex lock;
GBusType bus_type;
GDBusConnection *connection;
......@@ -214,7 +214,7 @@ g_dbus_object_manager_client_finalize (GObject *object)
if (manager->priv->get_proxy_type_destroy_notify != NULL)
manager->priv->get_proxy_type_destroy_notify (manager->priv->get_proxy_type_user_data);
g_mutex_free (manager->priv->lock);
g_mutex_clear (&manager->priv->lock);
if (G_OBJECT_CLASS (g_dbus_object_manager_client_parent_class)->finalize != NULL)
G_OBJECT_CLASS (g_dbus_object_manager_client_parent_class)->finalize (object);
......@@ -572,7 +572,7 @@ g_dbus_object_manager_client_init (GDBusObjectManagerClient *manager)
manager->priv = G_TYPE_INSTANCE_GET_PRIVATE (manager,
G_TYPE_DBUS_OBJECT_MANAGER_CLIENT,
GDBusObjectManagerClientPrivate);
manager->priv->lock = g_mutex_new ();
g_mutex_init (&manager->priv->lock);
manager->priv->map_object_path_to_object_proxy = g_hash_table_new_full (g_str_hash,
g_str_equal,
g_free,
......@@ -901,9 +901,9 @@ g_dbus_object_manager_client_get_connection (GDBusObjectManagerClient *manager)
{
GDBusConnection *ret;
g_return_val_if_fail (G_IS_DBUS_OBJECT_MANAGER_CLIENT (manager), NULL);
g_mutex_lock (manager->priv->lock);
g_mutex_lock (&manager->priv->lock);
ret = manager->priv->connection;
g_mutex_unlock (manager->priv->lock);
g_mutex_unlock (&manager->priv->lock);
return ret;
}
......@@ -923,9 +923,9 @@ g_dbus_object_manager_client_get_name (GDBusObjectManagerClient *manager)
{
const gchar *ret;
g_return_val_if_fail (G_IS_DBUS_OBJECT_MANAGER_CLIENT (manager), NULL);
g_mutex_lock (manager->priv->lock);
g_mutex_lock (&manager->priv->lock);
ret = manager->priv->name;
g_mutex_unlock (manager->priv->lock);
g_mutex_unlock (&manager->priv->lock);
return ret;
}
......@@ -945,9 +945,9 @@ g_dbus_object_manager_client_get_flags (GDBusObjectManagerClient *manager)
{
GDBusObjectManagerClientFlags ret;
g_return_val_if_fail (G_IS_DBUS_OBJECT_MANAGER_CLIENT (manager), G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_NONE);
g_mutex_lock (manager->priv->lock);
g_mutex_lock (&manager->priv->lock);
ret = manager->priv->flags;
g_mutex_unlock (manager->priv->lock);
g_mutex_unlock (&manager->priv->lock);
return ret;
}
......@@ -970,9 +970,9 @@ g_dbus_object_manager_client_get_name_owner (GDBusObjectManagerClient *manager)
{
gchar *ret;
g_return_val_if_fail (G_IS_DBUS_OBJECT_MANAGER_CLIENT (manager), NULL);
g_mutex_lock (manager->priv->lock);
g_mutex_lock (&manager->priv->lock);
ret = g_strdup (manager->priv->name_owner);
g_mutex_unlock (manager->priv->lock);
g_mutex_unlock (&manager->priv->lock);
return ret;
}
......@@ -994,15 +994,15 @@ signal_cb (GDBusConnection *connection,
GDBusObjectProxy *object_proxy;
GDBusInterface *interface;
g_mutex_lock (manager->priv->lock);
g_mutex_lock (&manager->priv->lock);
object_proxy = g_hash_table_lookup (manager->priv->map_object_path_to_object_proxy, object_path);
if (object_proxy == NULL)
{
g_mutex_unlock (manager->priv->lock);
g_mutex_unlock (&manager->priv->lock);
goto out;
}
g_object_ref (object_proxy);
g_mutex_unlock (manager->priv->lock);
g_mutex_unlock (&manager->priv->lock);
//g_debug ("yay, signal_cb %s %s: %s\n", signal_name, object_path, g_variant_print (parameters, TRUE));
......@@ -1224,7 +1224,7 @@ on_notify_g_name_owner (GObject *object,
gchar *old_name_owner;
gchar *new_name_owner;
g_mutex_lock (manager->priv->lock);
g_mutex_lock (&manager->priv->lock);
old_name_owner = manager->priv->name_owner;
new_name_owner = g_dbus_proxy_get_name_owner (manager->priv->control_proxy);
manager->priv->name_owner = NULL;
......@@ -1239,7 +1239,7 @@ on_notify_g_name_owner (GObject *object,
g_list_foreach (proxies, (GFunc) g_object_ref, NULL);
g_hash_table_remove_all (manager->priv->map_object_path_to_object_proxy);
g_mutex_unlock (manager->priv->lock);
g_mutex_unlock (&manager->priv->lock);
/* do the :name-owner notify with a NULL name - this way the user knows
* the ::object-proxy-removed following is because the name owner went
......@@ -1260,7 +1260,7 @@ on_notify_g_name_owner (GObject *object,
}
else
{
g_mutex_unlock (manager->priv->lock);
g_mutex_unlock (&manager->priv->lock);
}
if (new_name_owner != NULL)
......@@ -1299,9 +1299,9 @@ on_notify_g_name_owner (GObject *object,
/* do the :name-owner notify *AFTER* emitting ::object-proxy-added signals - this
* way the user knows that the signals were emitted because the name owner came back
*/
g_mutex_lock (manager->priv->lock);
g_mutex_lock (&manager->priv->lock);
manager->priv->name_owner = new_name_owner;
g_mutex_unlock (manager->priv->lock);
g_mutex_unlock (&manager->priv->lock);
g_object_notify (G_OBJECT (manager), "name-owner");
}
......@@ -1422,7 +1422,7 @@ add_interfaces (GDBusObjectManagerClient *manager,
g_return_if_fail (g_dbus_is_unique_name (name_owner));
g_mutex_lock (manager->priv->lock);
g_mutex_lock (&manager->priv->lock);
interface_added_signals = NULL;
added = FALSE;
......@@ -1526,7 +1526,7 @@ add_interfaces (GDBusObjectManagerClient *manager,
g_variant_unref (properties);
}
g_mutex_unlock (manager->priv->lock);
g_mutex_unlock (&manager->priv->lock);
/* now that we don't hold the lock any more, emit signals */
for (l = interface_added_signals; l != NULL; l = l->next)
......@@ -1559,7 +1559,7 @@ remove_interfaces (GDBusObjectManagerClient *manager,
guint num_interfaces;
guint num_interfaces_to_remove;
g_mutex_lock (manager->priv->lock);
g_mutex_lock (&manager->priv->lock);
op = g_hash_table_lookup (manager->priv->map_object_path_to_object_proxy, object_path);
if (op == NULL)
......@@ -1567,7 +1567,7 @@ remove_interfaces (GDBusObjectManagerClient *manager,
g_warning ("%s: Processing InterfaceRemoved signal for path %s but no object proxy exists",
G_STRLOC,
object_path);
g_mutex_unlock (manager->priv->lock);
g_mutex_unlock (&manager->priv->lock);
goto out;
}
......@@ -1583,14 +1583,14 @@ remove_interfaces (GDBusObjectManagerClient *manager,
{
g_object_ref (op);
g_warn_if_fail (g_hash_table_remove (manager->priv->map_object_path_to_object_proxy, object_path));
g_mutex_unlock (manager->priv->lock);
g_mutex_unlock (&manager->priv->lock);
g_signal_emit_by_name (manager, "object-removed", op);
g_object_unref (op);
}
else
{
g_object_ref (op);
g_mutex_unlock (manager->priv->lock);
g_mutex_unlock (&manager->priv->lock);
for (n = 0; interface_names != NULL && interface_names[n] != NULL; n++)
{
GDBusInterface *interface;
......@@ -1683,11 +1683,11 @@ g_dbus_object_manager_client_get_object (GDBusObjectManager *_manager,
GDBusObjectManagerClient *manager = G_DBUS_OBJECT_MANAGER_CLIENT (_manager);
GDBusObject *ret;
g_mutex_lock (manager->priv->lock);
g_mutex_lock (&manager->priv->lock);
ret = g_hash_table_lookup (manager->priv->map_object_path_to_object_proxy, object_path);
if (ret != NULL)
g_object_ref (ret);
g_mutex_unlock (manager->priv->lock);
g_mutex_unlock (&manager->priv->lock);
return ret;
}
......@@ -1720,10 +1720,10 @@ g_dbus_object_manager_client_get_objects (GDBusObjectManager *_manager)
g_return_val_if_fail (G_IS_DBUS_OBJECT_MANAGER_CLIENT (manager), NULL);
g_mutex_lock (manager->priv->lock);
g_mutex_lock (&manager->priv->lock);
ret = g_hash_table_get_values (manager->priv->map_object_path_to_object_proxy);
g_list_foreach (ret, (GFunc) g_object_ref, NULL);
g_mutex_unlock (manager->priv->lock);
g_mutex_unlock (&manager->priv->lock);
return ret;
}
......
......@@ -81,7 +81,7 @@ static gboolean g_dbus_object_manager_server_unexport_unlocked (GDBusObjectManag
struct _GDBusObjectManagerServerPrivate
{
GMutex *lock;
GMutex lock;
GDBusConnection *connection;
gchar *object_path;
gchar *object_path_ending_in_slash;
......@@ -117,7 +117,7 @@ g_dbus_object_manager_server_finalize (GObject *object)
g_free (manager->priv->object_path);
g_free (manager->priv->object_path_ending_in_slash);
g_mutex_free (manager->priv->lock);
g_mutex_clear (&manager->priv->lock);
if (G_OBJECT_CLASS (g_dbus_object_manager_server_parent_class)->finalize != NULL)
G_OBJECT_CLASS (g_dbus_object_manager_server_parent_class)->finalize (object);
......@@ -134,9 +134,9 @@ g_dbus_object_manager_server_get_property (GObject *object,
switch (prop_id)
{
case PROP_CONNECTION:
g_mutex_lock (manager->priv->lock);
g_mutex_lock (&manager->priv->lock);
g_value_set_object (value, manager->priv->connection);
g_mutex_unlock (manager->priv->lock);
g_mutex_unlock (&manager->priv->lock);
break;
case PROP_OBJECT_PATH:
......@@ -230,7 +230,7 @@ g_dbus_object_manager_server_init (GDBusObjectManagerServer *manager)
manager->priv = G_TYPE_INSTANCE_GET_PRIVATE (manager,
G_TYPE_DBUS_OBJECT_MANAGER_SERVER,
GDBusObjectManagerServerPrivate);
manager->priv->lock = g_mutex_new ();
g_mutex_init (&manager->priv->lock);
manager->priv->map_object_path_to_data = g_hash_table_new_full (g_str_hash,
g_str_equal,
g_free,
......@@ -277,11 +277,11 @@ g_dbus_object_manager_server_set_connection (GDBusObjectManagerServer *manager,
g_return_if_fail (G_IS_DBUS_OBJECT_MANAGER_SERVER (manager));
g_return_if_fail (connection == NULL || G_IS_DBUS_CONNECTION (connection));
g_mutex_lock (manager->priv->lock);
g_mutex_lock (&manager->priv->lock);
if (manager->priv->connection == connection)
{
g_mutex_unlock (manager->priv->lock);
g_mutex_unlock (&manager->priv->lock);
goto out;
}
......@@ -296,7 +296,7 @@ g_dbus_object_manager_server_set_connection (GDBusObjectManagerServer *manager,
if (manager->priv->connection != NULL)
export_all (manager);
g_mutex_unlock (manager->priv->lock);
g_mutex_unlock (&manager->priv->lock);
g_object_notify (G_OBJECT (manager), "connection");
out:
......@@ -320,9 +320,9 @@ g_dbus_object_manager_server_get_connection (GDBusObjectManagerServer *manager)
{
GDBusConnection *ret;
g_return_val_if_fail (G_IS_DBUS_OBJECT_MANAGER_SERVER (manager), NULL);
g_mutex_lock (manager->priv->lock);
g_mutex_lock (&manager->priv->lock);
ret = manager->priv->connection != NULL ? g_object_ref (manager->priv->connection) : NULL;
g_mutex_unlock (manager->priv->lock);
g_mutex_unlock (&manager->priv->lock);
return ret;
}
......@@ -406,10 +406,10 @@ on_interface_added (GDBusObject *object,
{
RegistrationData *data = user_data;
const gchar *object_path;
g_mutex_lock (data->manager->priv->lock);
g_mutex_lock (&data->manager->priv->lock);
object_path = g_dbus_object_get_object_path (G_DBUS_OBJECT (data->object));
registration_data_export_interface (data, G_DBUS_INTERFACE_SKELETON (interface), object_path);
g_mutex_unlock (data->manager->priv->lock);
g_mutex_unlock (&data->manager->priv->lock);
}
static void
......@@ -418,9 +418,9 @@ on_interface_removed (GDBusObject *object,
gpointer user_data)
{
RegistrationData *data = user_data;
g_mutex_lock (data->manager->priv->lock);
g_mutex_lock (&data->manager->priv->lock);
registration_data_unexport_interface (data, G_DBUS_INTERFACE_SKELETON (interface));
g_mutex_unlock (data->manager->priv->lock);
g_mutex_unlock (&data->manager->priv->lock);
}
/* ---------------------------------------------------------------------------------------------------- */
......@@ -535,10 +535,10 @@ g_dbus_object_manager_server_export (GDBusObjectManagerServer *manager,
GDBusObjectSkeleton *object)
{
g_return_if_fail (G_IS_DBUS_OBJECT_MANAGER_SERVER (manager));
g_mutex_lock (manager->priv->lock);
g_mutex_lock (&manager->priv->lock);
g_dbus_object_manager_server_export_unlocked (manager, object,
g_dbus_object_get_object_path (G_DBUS_OBJECT (object)));
g_mutex_unlock (manager->priv->lock);
g_mutex_unlock (&manager->priv->lock);
}
/**
......@@ -569,7 +569,7 @@ g_dbus_object_manager_server_export_uniquely (GDBusObjectManagerServer *manager,
g_return_if_fail (G_IS_DBUS_OBJECT (object));
g_return_if_fail (g_str_has_prefix (orig_object_path, manager->priv->object_path_ending_in_slash));
g_mutex_lock (manager->priv->lock);
g_mutex_lock (&manager->priv->lock);
object_path = g_strdup (orig_object_path);
count = 1;
......@@ -589,7 +589,7 @@ g_dbus_object_manager_server_export_uniquely (GDBusObjectManagerServer *manager,
g_dbus_object_manager_server_export_unlocked (manager, object, object_path);
g_mutex_unlock (manager->priv->lock);
g_mutex_unlock (&manager->priv->lock);
if (modified)
g_dbus_object_skeleton_set_object_path (G_DBUS_OBJECT_SKELETON (object), object_path);
......@@ -658,9 +658,9 @@ g_dbus_object_manager_server_unexport (GDBusObjectManagerServer *manager,
{
gboolean ret;
g_return_val_if_fail (G_IS_DBUS_OBJECT_MANAGER_SERVER (manager), FALSE);
g_mutex_lock (manager->priv->lock);
g_mutex_lock (&manager->priv->lock);
ret = g_dbus_object_manager_server_unexport_unlocked (manager, object_path);
g_mutex_unlock (manager->priv->lock);
g_mutex_unlock (&manager->priv->lock);
return ret;
}
......@@ -798,7 +798,7 @@ manager_method_call (GDBusConnection *connection,
GHashTableIter object_iter;
RegistrationData *data;
g_mutex_lock (manager->priv->lock);
g_mutex_lock (&manager->priv->lock);
if (g_strcmp0 (method_name, "GetManagedObjects") == 0)
{
......@@ -840,7 +840,7 @@ manager_method_call (GDBusConnection *connection,
"Unknown method %s - only GetManagedObjects() is supported",
method_name);
}
g_mutex_unlock (manager->priv->lock);
g_mutex_unlock (&manager->priv->lock);
}
static const GDBusInterfaceVTable manager_interface_vtable =
......@@ -948,7 +948,7 @@ g_dbus_object_manager_server_get_objects (GDBusObjectManager *_manager)
GHashTableIter iter;
RegistrationData *data;
g_mutex_lock (manager->priv->lock);
g_mutex_lock (&manager->priv->lock);
ret = NULL;
g_hash_table_iter_init (&iter, manager->priv->map_object_path_to_data);
......@@ -957,7 +957,7 @@ g_dbus_object_manager_server_get_objects (GDBusObjectManager *_manager)
ret = g_list_prepend (ret, g_object_ref (data->object));
}
g_mutex_unlock (manager->priv->lock);
g_mutex_unlock (&manager->priv->lock);
return ret;
}
......@@ -979,11 +979,11 @@ g_dbus_object_manager_server_get_object (GDBusObjectManager *_manager,
ret = NULL;
g_mutex_lock (manager->priv->lock);
g_mutex_lock (&manager->priv->lock);
data = g_hash_table_lookup (manager->priv->map_object_path_to_data, object_path);
if (data != NULL)
ret = g_object_ref (data->object);
g_mutex_unlock (manager->priv->lock);
g_mutex_unlock (&manager->priv->lock);
return ret;
}
......
......@@ -46,7 +46,7 @@
struct _GDBusObjectProxyPrivate
{
GMutex *lock;
GMutex lock;
GHashTable *map_name_to_iface;
gchar *object_path;
GDBusConnection *connection;
......@@ -71,7 +71,7 @@ g_dbus_object_proxy_finalize (GObject *object)
g_hash_table_unref (proxy->priv->map_name_to_iface);
g_mutex_free (proxy->priv->lock);
g_mutex_clear (&proxy->priv->lock);
if (G_OBJECT_CLASS (g_dbus_object_proxy_parent_class)->finalize != NULL)
G_OBJECT_CLASS (g_dbus_object_proxy_parent_class)->finalize (object);
......@@ -88,9 +88,9 @@ g_dbus_object_proxy_get_property (GObject *object,
switch (prop_id)
{
case PROP_G_OBJECT_PATH:
g_mutex_lock (proxy->priv->lock);
g_mutex_lock (&proxy->priv->lock);
g_value_set_string (value, proxy->priv->object_path);
g_mutex_unlock (proxy->priv->lock);
g_mutex_unlock (&proxy->priv->lock);
break;
case PROP_G_CONNECTION:
......@@ -114,15 +114,15 @@ g_dbus_object_proxy_set_property (GObject *object,
switch (prop_id)
{
case PROP_G_OBJECT_PATH:
g_mutex_lock (proxy->priv->lock);
g_mutex_lock (&proxy->priv->lock);
proxy->priv->object_path = g_value_dup_string (value);
g_mutex_unlock (proxy->priv->lock);
g_mutex_unlock (&proxy->priv->lock);
break;
case PROP_G_CONNECTION:
g_mutex_lock (proxy->priv->lock);
g_mutex_lock (&proxy->priv->lock);
proxy->priv->connection = g_value_dup_object (value);
g_mutex_unlock (proxy->priv->lock);
g_mutex_unlock (&proxy->priv->lock);
break;
default:
......@@ -183,7 +183,7 @@ g_dbus_object_proxy_init (GDBusObjectProxy *proxy)
proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy,
G_TYPE_DBUS_OBJECT_PROXY,
GDBusObjectProxyPrivate);
proxy->priv->lock = g_mutex_new ();
g_mutex_init (&proxy->priv->lock);
proxy->priv->map_name_to_iface = g_hash_table_new_full (g_str_hash,
g_str_equal,
g_free,
......@@ -195,9 +195,9 @@ g_dbus_object_proxy_get_object_path (GDBusObject *object)
{
GDBusObjectProxy *proxy = G_DBUS_OBJECT_PROXY (object);
const gchar *ret;
g_mutex_lock (proxy->priv->lock);
g_mutex_lock (&proxy->priv->lock);
ret = proxy->priv->object_path;
g_mutex_unlock (proxy->priv->lock);
g_mutex_unlock (&proxy->priv->lock);
return ret;
}
......@@ -217,9 +217,9 @@ g_dbus_object_proxy_get_connection (GDBusObjectProxy *proxy)
{
GDBusConnection *ret;
g_return_val_if_fail (G_IS_DBUS_OBJECT_PROXY (proxy), NULL);
g_mutex_lock (proxy->priv->lock);
g_mutex_lock (&proxy->priv->lock);
ret = proxy->priv->connection;
g_mutex_unlock (proxy->priv->lock);
g_mutex_unlock (&proxy->priv->lock);
return ret;
}
......@@ -233,11 +233,11 @@ g_dbus_object_proxy_get_interface (GDBusObject *object,
g_return_val_if_fail (G_IS_DBUS_OBJECT_PROXY (proxy), NULL);
g_return_val_if_fail (g_dbus_is_interface_name (interface_name), NULL);
g_mutex_lock (proxy->priv->lock);
g_mutex_lock (&proxy->priv->lock);
ret = g_hash_table_lookup (proxy->priv->map_name_to_iface, interface_name);
if (ret != NULL)
g_object_ref (ret);
g_mutex_unlock (proxy->priv->lock);
g_mutex_unlock (&proxy->priv->lock);
return (GDBusInterface *) ret; /* TODO: proper cast */
}
......@@ -252,10 +252,10 @@ g_dbus_object_proxy_get_interfaces (GDBusObject *object)
ret = NULL;
g_mutex_lock (proxy->priv->lock);
g_mutex_lock (&proxy->priv->lock);
ret = g_hash_table_get_values (proxy->priv->map_name_to_iface);
g_list_foreach (ret, (GFunc) g_object_ref, NULL);
g_mutex_unlock (proxy->priv->lock);
g_mutex_unlock (&proxy->priv->lock);
return ret;
}
......@@ -296,7 +296,7 @@ _g_dbus_object_proxy_add_interface (GDBusObjectProxy *proxy,
g_return_if_fail (G_IS_DBUS_OBJECT_PROXY (proxy));
g_return_if_fail (G_IS_DBUS_PROXY (interface_proxy));
g_mutex_lock (proxy->priv->lock);
g_mutex_lock (&proxy->priv->lock);
interface_name = g_dbus_proxy_get_interface_name (interface_proxy);
interface_proxy_to_remove = g_hash_table_lookup (proxy->priv->map_name_to_iface, interface_name);
......@@ -310,7 +310,7 @@ _g_dbus_object_proxy_add_interface (GDBusObjectProxy *proxy,