[gvfs/gdbus: 8/17] gdbus: Strip unmapped GError quark strings



commit 0fa010bedf4c727358e7ee54e21248b6922004a8
Author: Tomas Bzatek <tbzatek redhat com>
Date:   Thu Jun 2 11:36:18 2011 +0200

    gdbus: Strip unmapped GError quark strings
    
    Typically happens when receiving side is not aware of extra GError domains
    registered on sending (server) side, such as GDU_ERROR.
    
    While the receiving side will get different error (G_IO_ERROR_DBUS_ERROR)
    it's not usually a problem as long as the error message is preserved.

 monitor/proxy/gproxydrive.c  |   84 ++++++++++++++++++++++++++----------------
 monitor/proxy/gproxymount.c  |   21 ++++++----
 monitor/proxy/gproxyvolume.c |   21 ++++++----
 3 files changed, 78 insertions(+), 48 deletions(-)
---
diff --git a/monitor/proxy/gproxydrive.c b/monitor/proxy/gproxydrive.c
index 6453b00..3e9446e 100644
--- a/monitor/proxy/gproxydrive.c
+++ b/monitor/proxy/gproxydrive.c
@@ -557,15 +557,20 @@ eject_cb (GVfsRemoteVolumeMonitor *proxy,
       GSimpleAsyncResult *simple;
 
       if (error != NULL)
-        simple = g_simple_async_result_new_from_error (G_OBJECT (data->drive),
-                                                       data->callback,
-                                                       data->user_data,
-                                                       error);
+        {
+          g_dbus_error_strip_remote_error (error);
+          simple = g_simple_async_result_new_from_error (G_OBJECT (data->drive),
+                                                         data->callback,
+                                                         data->user_data,
+                                                         error);
+        }
       else
-        simple = g_simple_async_result_new (G_OBJECT (data->drive),
-                                            data->callback,
-                                            data->user_data,
-                                            NULL);
+        {
+          simple = g_simple_async_result_new (G_OBJECT (data->drive),
+                                              data->callback,
+                                              data->user_data,
+                                              NULL);
+        }
       g_simple_async_result_complete (simple);
       g_object_unref (simple);
     }
@@ -697,15 +702,20 @@ stop_cb (GVfsRemoteVolumeMonitor *proxy,
       GSimpleAsyncResult *simple;
 
       if (error != NULL)
-        simple = g_simple_async_result_new_from_error (G_OBJECT (data->drive),
-                                                       data->callback,
-                                                       data->user_data,
-                                                       error);
+        {
+          g_dbus_error_strip_remote_error (error);
+          simple = g_simple_async_result_new_from_error (G_OBJECT (data->drive),
+                                                         data->callback,
+                                                         data->user_data,
+                                                         error);
+        }
       else
-        simple = g_simple_async_result_new (G_OBJECT (data->drive),
-                                            data->callback,
-                                            data->user_data,
-                                            NULL);
+        {
+          simple = g_simple_async_result_new (G_OBJECT (data->drive),
+                                              data->callback,
+                                              data->user_data,
+                                              NULL);
+        }
       g_simple_async_result_complete (simple);
       g_object_unref (simple);
     }
@@ -830,15 +840,20 @@ if (data->cancelled_handler_id > 0)
       GSimpleAsyncResult *simple;
 
       if (error != NULL)
-        simple = g_simple_async_result_new_from_error (G_OBJECT (data->drive),
-                                                       data->callback,
-                                                       data->user_data,
-                                                       error);
+        {
+          g_dbus_error_strip_remote_error (error);
+          simple = g_simple_async_result_new_from_error (G_OBJECT (data->drive),
+                                                         data->callback,
+                                                         data->user_data,
+                                                         error);
+        }
       else
-        simple = g_simple_async_result_new (G_OBJECT (data->drive),
-                                            data->callback,
-                                            data->user_data,
-                                            NULL);
+        {
+          simple = g_simple_async_result_new (G_OBJECT (data->drive),
+                                              data->callback,
+                                              data->user_data,
+                                              NULL);
+        }
       g_simple_async_result_complete_in_idle (simple);
       g_object_unref (simple);
     }
@@ -981,15 +996,20 @@ poll_for_media_cb (GVfsRemoteVolumeMonitor *proxy,
       GSimpleAsyncResult *simple;
 
       if (error != NULL)
-        simple = g_simple_async_result_new_from_error (G_OBJECT (data->drive),
-                                                       data->callback,
-                                                       data->user_data,
-                                                       error);
+        {
+          g_dbus_error_strip_remote_error (error);
+          simple = g_simple_async_result_new_from_error (G_OBJECT (data->drive),
+                                                         data->callback,
+                                                         data->user_data,
+                                                         error);
+        }
       else
-        simple = g_simple_async_result_new (G_OBJECT (data->drive),
-                                            data->callback,
-                                            data->user_data,
-                                            NULL);
+        {
+          simple = g_simple_async_result_new (G_OBJECT (data->drive),
+                                              data->callback,
+                                              data->user_data,
+                                              NULL);
+        }
       g_simple_async_result_complete (simple);
       g_object_unref (simple);
     }
diff --git a/monitor/proxy/gproxymount.c b/monitor/proxy/gproxymount.c
index dde2865..c2036e9 100644
--- a/monitor/proxy/gproxymount.c
+++ b/monitor/proxy/gproxymount.c
@@ -507,15 +507,20 @@ unmount_cb (GVfsRemoteVolumeMonitor *proxy,
     {
       GSimpleAsyncResult *simple;
       if (error != NULL)
-        simple = g_simple_async_result_new_from_error (G_OBJECT (data->mount),
-                                                       data->callback,
-                                                       data->user_data,
-                                                       error);
+        {
+          g_dbus_error_strip_remote_error (error);
+          simple = g_simple_async_result_new_from_error (G_OBJECT (data->mount),
+                                                         data->callback,
+                                                         data->user_data,
+                                                         error);
+        }
       else
-        simple = g_simple_async_result_new (G_OBJECT (data->mount),
-                                            data->callback,
-                                            data->user_data,
-                                            NULL);
+        {
+          simple = g_simple_async_result_new (G_OBJECT (data->mount),
+                                              data->callback,
+                                              data->user_data,
+                                              NULL);
+        }
       g_simple_async_result_complete (simple);
       g_object_unref (simple);
     }
diff --git a/monitor/proxy/gproxyvolume.c b/monitor/proxy/gproxyvolume.c
index a3e8e1e..c616812 100644
--- a/monitor/proxy/gproxyvolume.c
+++ b/monitor/proxy/gproxyvolume.c
@@ -744,15 +744,20 @@ mount_cb (GVfsRemoteVolumeMonitor *proxy,
       GSimpleAsyncResult *simple;
 
       if (error != NULL)
-        simple = g_simple_async_result_new_from_error (G_OBJECT (data->volume),
-                                                       data->callback,
-                                                       data->user_data,
-                                                       error);
+        {
+          g_dbus_error_strip_remote_error (error);
+          simple = g_simple_async_result_new_from_error (G_OBJECT (data->volume),
+                                                         data->callback,
+                                                         data->user_data,
+                                                         error);
+        }
       else
-        simple = g_simple_async_result_new (G_OBJECT (data->volume),
-                                            data->callback,
-                                            data->user_data,
-                                            NULL);
+        {
+          simple = g_simple_async_result_new (G_OBJECT (data->volume),
+                                              data->callback,
+                                              data->user_data,
+                                              NULL);
+        }
       g_simple_async_result_complete_in_idle (simple);
       g_object_unref (simple);
     }



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