[gvfs/gdbus: 12/30] gdbus: Don't warn if MountOp could not be found



commit a58d05b6b3f0088056b89f1ade0ad68d08c8cf2d
Author: Tomas Bzatek <tbzatek redhat com>
Date:   Tue Jun 7 17:56:40 2011 +0200

    gdbus: Don't warn if MountOp could not be found
    
    This typically happens when dbus eavesdrop is turned on and
    we receive signals that don't belong to us. So simply silence
    all warnings and ignore these events.
    
    See https://bugs.freedesktop.org/show_bug.cgi?id=37890
    
    Also, the hash table might not have been initialized yet,
    added few tests.

 monitor/proxy/gproxymountoperation.c |   51 +++++++++++++--------------------
 1 files changed, 20 insertions(+), 31 deletions(-)
---
diff --git a/monitor/proxy/gproxymountoperation.c b/monitor/proxy/gproxymountoperation.c
index 0edaf96..5253d59 100644
--- a/monitor/proxy/gproxymountoperation.c
+++ b/monitor/proxy/gproxymountoperation.c
@@ -186,17 +186,15 @@ g_proxy_mount_operation_handle_ask_password (const gchar  *wrapped_id,
 
   g_return_if_fail (wrapped_id != NULL);
 
+  if (id_to_op == NULL)
+    goto out;
+  
   G_LOCK (proxy_op);
   data = g_hash_table_lookup (id_to_op, wrapped_id);
   G_UNLOCK (proxy_op);
 
   if (data == NULL)
-    {
-      g_warning ("%s: No GMountOperation for id `%s'",
-                 G_STRFUNC,
-                 wrapped_id);
-      goto out;
-    }
+    goto out;
   
   if (data->reply_handler_id == 0)
     {
@@ -228,17 +226,15 @@ g_proxy_mount_operation_handle_ask_question (const gchar        *wrapped_id,
 
   g_return_if_fail (wrapped_id != NULL);
 
+  if (id_to_op == NULL)
+    goto out;
+  
   G_LOCK (proxy_op);
   data = g_hash_table_lookup (id_to_op, wrapped_id);
   G_UNLOCK (proxy_op);
 
   if (data == NULL)
-    {
-      g_warning ("%s: No GMountOperation for id `%s'",
-                 G_STRFUNC,
-                 wrapped_id);
-      goto out;
-    }
+    goto out;
 
   if (data->reply_handler_id == 0)
     {
@@ -274,18 +270,15 @@ g_proxy_mount_operation_handle_show_processes (const gchar        *wrapped_id,
 
   processes = NULL;
 
+  if (id_to_op == NULL)
+    goto out;
+  
   G_LOCK (proxy_op);
   data = g_hash_table_lookup (id_to_op, wrapped_id);
   G_UNLOCK (proxy_op);
 
   if (data == NULL)
-    {
-      g_warning ("%s: No GMountOperation for id `%s'",
-                 G_STRFUNC,
-                 wrapped_id);
-      goto out;
-    }
-
+    goto out;
   
   processes = g_array_new (FALSE, FALSE, sizeof (GPid));
   g_variant_iter_init (&iter, pids);
@@ -320,17 +313,15 @@ g_proxy_mount_operation_handle_aborted (const gchar *wrapped_id)
 
   g_return_if_fail (wrapped_id != NULL);
 
+  if (id_to_op == NULL)
+    goto out;
+
   G_LOCK (proxy_op);
   data = g_hash_table_lookup (id_to_op, wrapped_id);
   G_UNLOCK (proxy_op);
 
   if (data == NULL)
-    {
-      g_warning ("%s: No GMountOperation for id `%s'",
-                 G_STRFUNC,
-                 wrapped_id);
-      goto out;
-    }
+    goto out;
 
   g_signal_emit_by_name (data->op, "aborted");
 
@@ -348,13 +339,11 @@ g_proxy_mount_operation_destroy (const gchar *wrapped_id)
   if (strlen (wrapped_id) == 0)
     return;
 
+  if (id_to_op == NULL)
+    return;
+
   G_LOCK (proxy_op);
-  if (!g_hash_table_remove (id_to_op, wrapped_id))
-    {
-      g_warning ("%s: No GMountOperation for id `%s'",
-                 G_STRFUNC,
-                 wrapped_id);
-    }
+  g_hash_table_remove (id_to_op, wrapped_id);
   G_UNLOCK (proxy_op);
 }
 



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