Fix the filetransfer portal initialization
authorMatthias Clasen <mclasen@redhat.com>
Wed, 15 Jan 2020 15:58:54 +0000 (10:58 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Wed, 15 Jan 2020 15:58:54 +0000 (10:58 -0500)
Reusing the cancellable only works if you don't throw
it away after first use.

gdk/filetransferportal.c

index 7f0a35c303c3f7fdfcff4bb4905a7aa1a8b5ce78..ba5f6d4ef08640c9483629fa40c3d0b7677119ee 100644 (file)
@@ -120,7 +120,7 @@ ensure_file_transfer_portal (void)
       cancellable = g_cancellable_new ();
  
       done = FALSE;
-      timeout_id = g_timeout_add_full (500, 0, give_up_on_proxy, cancellable, g_object_unref);
+      timeout_id = g_timeout_add (500, give_up_on_proxy, cancellable);
       g_bus_get (G_BUS_TYPE_SESSION,
                  cancellable,
                  got_bus,
@@ -131,7 +131,8 @@ ensure_file_transfer_portal (void)
 
       if (bus)
         {
-          timeout_id = g_timeout_add_full (500, 0, give_up_on_proxy, cancellable, g_object_unref);
+          done = FALSE;
+          timeout_id = g_timeout_add (500, give_up_on_proxy, cancellable);
           g_dbus_proxy_new (bus,
                             G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES
                             | G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS
@@ -149,6 +150,8 @@ ensure_file_transfer_portal (void)
 
           g_clear_object (&bus);
         }
+
+      g_clear_object (&cancellable);
     }
 
   if (file_transfer_proxy)