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
This commit is contained in:
Fabrice Bellet 2017-02-03 18:05:59 +01:00 committed by Philip Withnall
parent cb26c677e6
commit c457ec053d

View File

@ -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);
}
/* ---------------------------------------------------------------------------------------------------- */