From 06f5de77f04f16480e642f7efee9dc4bdfba6778 Mon Sep 17 00:00:00 2001 From: David Zeuthen Date: Thu, 26 May 2011 10:07:38 -0400 Subject: [PATCH] GDBusProxy: Fix incorrect locking Pointed out by mclasen. Signed-off-by: David Zeuthen --- gio/gdbusproxy.c | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/gio/gdbusproxy.c b/gio/gdbusproxy.c index 02b6086..b849f8a 100644 --- a/gio/gdbusproxy.c +++ b/gio/gdbusproxy.c @@ -827,9 +827,15 @@ on_signal_received (GDBusConnection *connection, G_LOCK (signal_subscription_lock); proxy = data->proxy; if (proxy == NULL) - goto out; - g_object_ref (proxy); - G_UNLOCK (signal_subscription_lock); + { + G_UNLOCK (signal_subscription_lock); + goto out; + } + else + { + g_object_ref (proxy); + G_UNLOCK (signal_subscription_lock); + } if (!proxy->priv->initialized) goto out; @@ -919,9 +925,15 @@ on_properties_changed (GDBusConnection *connection, G_LOCK (signal_subscription_lock); proxy = data->proxy; if (proxy == NULL) - goto out; - g_object_ref (proxy); - G_UNLOCK (signal_subscription_lock); + { + G_UNLOCK (signal_subscription_lock); + goto out; + } + else + { + g_object_ref (proxy); + G_UNLOCK (signal_subscription_lock); + } changed_properties = NULL; invalidated_properties = NULL; @@ -1117,9 +1129,15 @@ on_name_owner_changed (GDBusConnection *connection, G_LOCK (signal_subscription_lock); proxy = data->proxy; if (proxy == NULL) - goto out; - g_object_ref (proxy); - G_UNLOCK (signal_subscription_lock); + { + G_UNLOCK (signal_subscription_lock); + goto out; + } + else + { + g_object_ref (proxy); + G_UNLOCK (signal_subscription_lock); + } /* if we are already trying to load properties, cancel that */ if (proxy->priv->get_all_cancellable != NULL) -- 2.7.4