diff options
author | Maciej S. Szmigiero <mail@maciej.szmigiero.name> | 2022-10-09 23:34:06 +0200 |
---|---|---|
committer | Maciej S. Szmigiero <mail@maciej.szmigiero.name> | 2022-10-11 14:51:41 +0200 |
commit | 93351f169bc57bc993d7dbaacce601ec25b1c60f (patch) | |
tree | 4316a134b4200a353c49c9cd774d804371b2b6ce /src/gclue-client-info.c | |
parent | 3689c50e15b7e67017f961f66605d2de68c08a64 (diff) | |
download | geoclue-93351f169bc57bc993d7dbaacce601ec25b1c60f.tar.gz |
Make sure to not cast user_data to GObjects in callback if call is canceled
This can abort at runtime if the object pointed to by user_data is already
gone by the time the callback is run.
Diffstat (limited to 'src/gclue-client-info.c')
-rw-r--r-- | src/gclue-client-info.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/gclue-client-info.c b/src/gclue-client-info.c index 7fc2ac7..9362c85 100644 --- a/src/gclue-client-info.c +++ b/src/gclue-client-info.c @@ -356,15 +356,18 @@ on_dbus_proxy_ready (GObject *source_object, GTask *task = G_TASK (user_data); gpointer *info = g_task_get_source_object (task); GClueClientInfoPrivate *priv = GCLUE_CLIENT_INFO (info)->priv; + GDBusProxy *dbus_proxy; GError *error = NULL; - priv->dbus_proxy = g_dbus_proxy_new_for_bus_finish (res, &error); - if (priv->dbus_proxy == NULL) { + dbus_proxy = g_dbus_proxy_new_for_bus_finish (res, &error); + if (dbus_proxy == NULL) { g_task_return_error (task, error); g_object_unref (task); return; } + priv->dbus_proxy = dbus_proxy; + g_dbus_proxy_call (priv->dbus_proxy, "GetConnectionUnixUser", g_variant_new ("(s)", priv->bus_name), |