[gtk+/wip/alexl/file-chooser-portal] portal: Fix error handling



commit 9b8148da17cce1f34408ba2ca790a3eb1dbb6c66
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Jun 11 10:11:55 2016 -0400

    portal: Fix error handling
    
    We can get a D-Bus error back here, and we need to free
    the reply in any case.

 gtk/gtkfilechoosernativeportal.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkfilechoosernativeportal.c b/gtk/gtkfilechoosernativeportal.c
index fd53b13..7e50d17 100644
--- a/gtk/gtkfilechoosernativeportal.c
+++ b/gtk/gtkfilechoosernativeportal.c
@@ -214,6 +214,10 @@ open_file_msg_cb (GObject *source_object,
   GError *error = NULL;
 
   reply = g_dbus_connection_send_message_with_reply_finish (data->connection, res, &error);
+
+  if (reply && g_dbus_message_to_gerror (reply, &error))
+    g_clear_object (&reply);
+
   if (reply == NULL)
     {
       if (!data->hidden)
@@ -231,8 +235,9 @@ open_file_msg_cb (GObject *source_object,
       /* The dialog was hidden before we got the handle, close it now */
       send_close (data);
       filechooser_portal_data_free (data);
-      return;
     }
+
+  g_object_unref (reply);
 }
 
 static GVariant *


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