mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-02 07:23:41 +02:00
gdbus: fix deadlock on message cancel/timeout
The gdbus GTask port introduced a deadlock because some code had been using g_simple_async_result_complete_in_idle() to ensure that the callback didn't run until after a mutex was unlocked, but in the gtask version, the callback was being run immediately. Fix it to drop the mutex before calling g_task_return*(). Also, tweak tests/gdbus-connection to test this. https://bugzilla.gnome.org/show_bug.cgi?id=747349
This commit is contained in:
@@ -291,6 +291,9 @@ msg_cb_expect_error_disconnected (GDBusConnection *connection,
|
||||
GError *error;
|
||||
GVariant *result;
|
||||
|
||||
/* Make sure gdbusconnection isn't holding @connection's lock. (#747349) */
|
||||
g_dbus_connection_get_last_serial (connection);
|
||||
|
||||
error = NULL;
|
||||
result = g_dbus_connection_call_finish (connection,
|
||||
res,
|
||||
@@ -311,6 +314,9 @@ msg_cb_expect_error_unknown_method (GDBusConnection *connection,
|
||||
GError *error;
|
||||
GVariant *result;
|
||||
|
||||
/* Make sure gdbusconnection isn't holding @connection's lock. (#747349) */
|
||||
g_dbus_connection_get_last_serial (connection);
|
||||
|
||||
error = NULL;
|
||||
result = g_dbus_connection_call_finish (connection,
|
||||
res,
|
||||
@@ -331,6 +337,9 @@ msg_cb_expect_success (GDBusConnection *connection,
|
||||
GError *error;
|
||||
GVariant *result;
|
||||
|
||||
/* Make sure gdbusconnection isn't holding @connection's lock. (#747349) */
|
||||
g_dbus_connection_get_last_serial (connection);
|
||||
|
||||
error = NULL;
|
||||
result = g_dbus_connection_call_finish (connection,
|
||||
res,
|
||||
@@ -350,6 +359,9 @@ msg_cb_expect_error_cancelled (GDBusConnection *connection,
|
||||
GError *error;
|
||||
GVariant *result;
|
||||
|
||||
/* Make sure gdbusconnection isn't holding @connection's lock. (#747349) */
|
||||
g_dbus_connection_get_last_serial (connection);
|
||||
|
||||
error = NULL;
|
||||
result = g_dbus_connection_call_finish (connection,
|
||||
res,
|
||||
@@ -370,6 +382,9 @@ msg_cb_expect_error_cancelled_2 (GDBusConnection *connection,
|
||||
GError *error;
|
||||
GVariant *result;
|
||||
|
||||
/* Make sure gdbusconnection isn't holding @connection's lock. (#747349) */
|
||||
g_dbus_connection_get_last_serial (connection);
|
||||
|
||||
error = NULL;
|
||||
result = g_dbus_connection_call_finish (connection,
|
||||
res,
|
||||
|
Reference in New Issue
Block a user