mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-26 19:08:57 +02:00
GDBus: make use of reliable async cancellation
Call g_simple_async_result_set_check_cancellable() after all GSimpleAsyncResult creation in order to take advantage of the new reliable cancellation feature. The guarantee of reliable cancellation fixes a bug in dbusmenu (which was already assuming that cancellation was reliable). See this bug: https://bugs.launchpad.net/ubuntu/+source/libdbusmenu/+bug/953562 https://bugzilla.gnome.org/show_bug.cgi?id=672013 Signed-off-by: David Zeuthen <davidz@redhat.com>
This commit is contained in:
committed by
David Zeuthen
parent
1c42b6b092
commit
e3c7fdd7a4
@@ -856,6 +856,7 @@ g_dbus_address_get_stream (const gchar *address,
|
||||
callback,
|
||||
user_data,
|
||||
g_dbus_address_get_stream);
|
||||
g_simple_async_result_set_check_cancellable (res, cancellable);
|
||||
data = g_new0 (GetStreamData, 1);
|
||||
data->address = g_strdup (address);
|
||||
g_simple_async_result_set_op_res_gpointer (res,
|
||||
|
@@ -1246,6 +1246,7 @@ g_dbus_connection_flush (GDBusConnection *connection,
|
||||
callback,
|
||||
user_data,
|
||||
g_dbus_connection_flush);
|
||||
g_simple_async_result_set_check_cancellable (simple, cancellable);
|
||||
g_simple_async_result_run_in_thread (simple,
|
||||
flush_in_thread_func,
|
||||
G_PRIORITY_DEFAULT,
|
||||
@@ -1459,6 +1460,7 @@ g_dbus_connection_close (GDBusConnection *connection,
|
||||
callback,
|
||||
user_data,
|
||||
g_dbus_connection_close);
|
||||
g_simple_async_result_set_check_cancellable (simple, cancellable);
|
||||
_g_dbus_worker_close (connection->worker, cancellable, simple);
|
||||
g_object_unref (simple);
|
||||
}
|
||||
@@ -1916,6 +1918,7 @@ g_dbus_connection_send_message_with_reply_unlocked (GDBusConnection *connect
|
||||
callback,
|
||||
user_data,
|
||||
g_dbus_connection_send_message_with_reply);
|
||||
g_simple_async_result_set_check_cancellable (simple, cancellable);
|
||||
|
||||
if (g_cancellable_is_cancelled (cancellable))
|
||||
{
|
||||
@@ -5340,6 +5343,7 @@ g_dbus_connection_call_internal (GDBusConnection *connection,
|
||||
state->simple = g_simple_async_result_new (G_OBJECT (connection),
|
||||
callback, user_data,
|
||||
g_dbus_connection_call_internal);
|
||||
g_simple_async_result_set_check_cancellable (state->simple, cancellable);
|
||||
state->method_name = g_strjoin (".", interface_name, method_name, NULL);
|
||||
|
||||
if (reply_type == NULL)
|
||||
@@ -6859,6 +6863,7 @@ g_bus_get (GBusType bus_type,
|
||||
callback,
|
||||
user_data,
|
||||
g_bus_get);
|
||||
g_simple_async_result_set_check_cancellable (simple, cancellable);
|
||||
|
||||
error = NULL;
|
||||
connection = get_uninitialized_connection (bus_type, cancellable, &error);
|
||||
|
@@ -191,6 +191,7 @@ _g_socket_read_with_control_messages (GSocket *socket,
|
||||
callback,
|
||||
user_data,
|
||||
_g_socket_read_with_control_messages);
|
||||
g_simple_async_result_set_check_cancellable (data->simple, cancellable);
|
||||
|
||||
if (!g_socket_condition_check (socket, G_IO_IN))
|
||||
{
|
||||
|
@@ -1695,6 +1695,7 @@ async_initable_init_second_async (GAsyncInitable *initable,
|
||||
callback,
|
||||
user_data,
|
||||
NULL);
|
||||
g_simple_async_result_set_check_cancellable (data->simple, cancellable);
|
||||
|
||||
/* Check name ownership asynchronously - possibly also start the service */
|
||||
if (proxy->priv->name == NULL)
|
||||
@@ -1840,6 +1841,7 @@ get_connection_cb (GObject *source_object,
|
||||
data->callback,
|
||||
data->user_data,
|
||||
NULL);
|
||||
g_simple_async_result_set_check_cancellable (simple, data->cancellable);
|
||||
g_simple_async_result_take_error (simple, error);
|
||||
g_simple_async_result_complete_in_idle (simple);
|
||||
g_object_unref (simple);
|
||||
@@ -2698,6 +2700,7 @@ g_dbus_proxy_call_internal (GDBusProxy *proxy,
|
||||
callback,
|
||||
user_data,
|
||||
g_dbus_proxy_call_internal);
|
||||
g_simple_async_result_set_check_cancellable (simple, cancellable);
|
||||
|
||||
G_LOCK (properties_lock);
|
||||
|
||||
|
Reference in New Issue
Block a user