summaryrefslogtreecommitdiff
path: root/gdk/filetransferportal.c
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2020-02-04 14:08:10 +0100
committerAlexander Larsson <alexl@redhat.com>2020-02-04 14:08:10 +0100
commit85e59220a5cf690a7e3a50cf2811bdd4b4848136 (patch)
tree2f1d0b11127db295f16b049890cde132c10e9669 /gdk/filetransferportal.c
parenta3be0ec5f0af5e78540dfecfc95cdedc31b91b56 (diff)
downloadgtk+-85e59220a5cf690a7e3a50cf2811bdd4b4848136.tar.gz
filechooser portal: Free portal proxy when bus connection closes
This was blocking the clean exit from the testdbus shutdown in the defaultvalues test. The proxy was keeping the connection alive which blocks g_test_dbus_down().
Diffstat (limited to 'gdk/filetransferportal.c')
-rw-r--r--gdk/filetransferportal.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/gdk/filetransferportal.c b/gdk/filetransferportal.c
index 541fd85a24..a658d086a8 100644
--- a/gdk/filetransferportal.c
+++ b/gdk/filetransferportal.c
@@ -472,6 +472,14 @@ portal_file_deserializer (GdkContentDeserializer *deserializer)
}
static void
+connection_closed (GDBusConnection *connection,
+ gboolean remote_peer_vanished,
+ GError *error)
+{
+ g_clear_object (&file_transfer_proxy);
+}
+
+static void
got_proxy (GObject *source,
GAsyncResult *result,
gpointer data)
@@ -509,6 +517,10 @@ got_proxy (GObject *source,
portal_file_deserializer,
NULL,
NULL);
+
+ /* Free the singleton when the connection closes, important for test */
+ g_signal_connect (g_dbus_proxy_get_connection (G_DBUS_PROXY (file_transfer_proxy)),
+ "closed", G_CALLBACK (connection_closed), NULL);
}
void