[glib] GDBusProxy: Fix incorrect locking



commit 06f5de77f04f16480e642f7efee9dc4bdfba6778
Author: David Zeuthen <davidz redhat com>
Date:   Thu May 26 10:07:38 2011 -0400

    GDBusProxy: Fix incorrect locking
    
    Pointed out by mclasen.
    
    Signed-off-by: David Zeuthen <davidz redhat com>

 gio/gdbusproxy.c |   36 +++++++++++++++++++++++++++---------
 1 files 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)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]