summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabrice Bellet <fabrice@bellet.info>2017-02-03 18:05:59 +0100
committerPhilip Withnall <withnall@endlessm.com>2017-02-05 14:20:06 +0100
commitc457ec053d26aec8833705091f0ff6026555e9ca (patch)
tree07fc8eb8ead56b408f709ea9b2f4f0d51689b21c
parentcb26c677e691c33af1da9789f55f7a32a56eaa8f (diff)
downloadglib-c457ec053d26aec8833705091f0ff6026555e9ca.tar.gz
gdbus: make sure to stay locked when sending message
This patch fixes a case where schedule_writing_unlocked() was called without holding the write lock. The bug was introduced in commit 512e9b3b. https://bugzilla.gnome.org/show_bug.cgi?id=778002
-rw-r--r--gio/gdbusprivate.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/gio/gdbusprivate.c b/gio/gdbusprivate.c
index c7b126ead..ea05dcd3d 100644
--- a/gio/gdbusprivate.c
+++ b/gio/gdbusprivate.c
@@ -1571,10 +1571,10 @@ schedule_writing_unlocked (GDBusWorker *worker,
static void
schedule_pending_close (GDBusWorker *worker)
{
- if (!worker->pending_close_attempts)
- return;
-
- schedule_writing_unlocked (worker, NULL, NULL, NULL);
+ g_mutex_lock (&worker->write_lock);
+ if (worker->pending_close_attempts)
+ schedule_writing_unlocked (worker, NULL, NULL, NULL);
+ g_mutex_unlock (&worker->write_lock);
}
/* ---------------------------------------------------------------------------------------------------- */