[glib] gdbus: make sure to stay locked when sending message



commit c457ec053d26aec8833705091f0ff6026555e9ca
Author: Fabrice Bellet <fabrice bellet info>
Date:   Fri Feb 3 18:05:59 2017 +0100

    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 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/gio/gdbusprivate.c b/gio/gdbusprivate.c
index c7b126e..ea05dcd 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);
 }
 
 /* ---------------------------------------------------------------------------------------------------- */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]