From c457ec053d26aec8833705091f0ff6026555e9ca Mon Sep 17 00:00:00 2001 From: Fabrice Bellet Date: Fri, 3 Feb 2017 18:05:59 +0100 Subject: [PATCH] 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 --- gio/gdbusprivate.c | 8 ++++---- 1 file 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); } /* ---------------------------------------------------------------------------------------------------- */