[glib: 3/6] gdesktopappinfo: Unref GDBus call result GVariant if no callback is set




commit 026a69905eec18e9ea0486ea351496e461c8681e
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Fri Sep 2 20:34:21 2022 +0200

    gdesktopappinfo: Unref GDBus call result GVariant if no callback is set
    
    When launching URIs via dbus we may ignore the callback if one was not
    provided, however in such case we were also leaking the return value for
    the gdbus call.
    
    Unref it properly.
    
    Helps with: https://gitlab.gnome.org/GNOME/glib/-/issues/333

 gio/gdesktopappinfo.c | 3 +++
 1 file changed, 3 insertions(+)
---
diff --git a/gio/gdesktopappinfo.c b/gio/gdesktopappinfo.c
index 85b424dda8..af2311ca52 100644
--- a/gio/gdesktopappinfo.c
+++ b/gio/gdesktopappinfo.c
@@ -3108,6 +3108,9 @@ launch_uris_with_dbus_signal_cb (GObject      *object,
 
   if (data->callback)
     data->callback (object, result, data->user_data);
+  else if (!g_task_had_error (G_TASK (result)))
+    g_variant_unref (g_dbus_connection_call_finish (G_DBUS_CONNECTION (object),
+                                                    result, NULL));
 
   launch_uris_with_dbus_data_free (data);
 }


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