summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2019-03-26 16:12:49 +0100
committerBastien Nocera <hadess@hadess.net>2019-03-26 16:47:36 +0100
commit22a74a3479ec3bc1eefe976bf7fb06c0df0fd145 (patch)
tree0e4ee4204148d288826712d27fab996f34436c04
parentfe8d0ac49e95e846c832c7a597a76c9a7149ac71 (diff)
downloadgnome-bluetooth-gnome-3-28.tar.gz
settings: Cancel pending D-Bus calls on exitgnome-3-28
-rw-r--r--lib/bluetooth-settings-obexpush.c36
1 files changed, 28 insertions, 8 deletions
diff --git a/lib/bluetooth-settings-obexpush.c b/lib/bluetooth-settings-obexpush.c
index e3ba0eef..0bb7f154 100644
--- a/lib/bluetooth-settings-obexpush.c
+++ b/lib/bluetooth-settings-obexpush.c
@@ -66,6 +66,7 @@ G_DEFINE_TYPE(ObexAgent, obex_agent, G_TYPE_OBJECT)
static ObexAgent *agent;
static BluetoothClient *client;
+static GCancellable *cancellable;
static void
on_close_notification (NotifyNotification *notification)
@@ -116,7 +117,7 @@ notification_launch_action_on_file_cb (NotifyNotification *notification,
NULL,
G_DBUS_CALL_FLAGS_NONE,
-1,
- NULL,
+ cancellable,
NULL,
NULL);
@@ -404,7 +405,7 @@ check_if_bonded_or_ask (GDBusProxy *transfer,
MANAGER_SERVICE,
session,
SESSION_IFACE,
- NULL,
+ cancellable,
on_check_bonded_or_ask_session_acquired,
invocation);
g_variant_unref (v);
@@ -624,13 +625,25 @@ obex_agent_authorize_push (GObject *source_object,
GAsyncResult *res,
gpointer user_data)
{
- GDBusProxy *transfer = g_dbus_proxy_new_for_bus_finish (res, NULL);
- GDBusMethodInvocation *invocation = user_data;
- GVariant *variant = g_dbus_proxy_get_cached_property (transfer, "Name");
- const gchar *filename = g_variant_get_string (variant, NULL);
+ GDBusProxy *transfer;
+ GError *error = NULL;
+ GDBusMethodInvocation *invocation;
+ GVariant *variant;
+ const gchar *filename;
char *template;
int fd;
+ transfer = g_dbus_proxy_new_for_bus_finish (res, &error);
+ if (!transfer) {
+ g_debug ("obex_agent_authorize_push() failed: %s", error->message);
+ g_error_free (error);
+ return;
+ }
+
+ invocation = user_data;
+ variant = g_dbus_proxy_get_cached_property (transfer, "Name");
+ filename = g_variant_get_string (variant, NULL);
+
g_debug ("AuthorizePush received");
template = g_build_filename (g_get_user_cache_dir (), "obexd", "XXXXXX", NULL);
@@ -679,7 +692,7 @@ handle_method_call (GDBusConnection *connection,
MANAGER_SERVICE,
transfer,
TRANSFER_IFACE,
- NULL,
+ cancellable,
obex_agent_authorize_push,
invocation);
} else {
@@ -713,7 +726,7 @@ obexd_appeared_cb (GDBusConnection *connection,
NULL,
G_DBUS_CALL_FLAGS_NONE,
-1,
- NULL,
+ cancellable,
NULL,
NULL);
}
@@ -821,6 +834,10 @@ obex_agent_down (void)
NULL);
}
+ if (cancellable != NULL) {
+ g_cancellable_cancel (cancellable);
+ g_clear_object (&cancellable);
+ }
g_clear_object (&agent);
g_clear_object (&client);
}
@@ -834,4 +851,7 @@ obex_agent_up (void)
if (!notify_init ("gnome-bluetooth")) {
g_warning("Unable to initialize the notification system");
}
+
+ g_assert (cancellable == NULL);
+ cancellable = g_cancellable_new ();
}