mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 03:16:17 +01:00
Bug 635626 – GDBus message idle can execute while flushes are pending
https://bugzilla.gnome.org/show_bug.cgi?id=635626 Signed-off-by: David Zeuthen <davidz@redhat.com>
This commit is contained in:
parent
735fcf918e
commit
09ce9dc542
@ -430,6 +430,7 @@ struct GDBusWorker
|
||||
gint num_writes_pending;
|
||||
guint64 write_num_messages_written;
|
||||
GList *write_pending_flushes;
|
||||
gboolean flush_pending;
|
||||
};
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------------- */
|
||||
@ -1155,6 +1156,12 @@ ostream_flush_cb (GObject *source_object,
|
||||
if (error != NULL)
|
||||
g_error_free (error);
|
||||
|
||||
/* Make sure we tell folks that we don't have additional
|
||||
flushes pending */
|
||||
g_mutex_lock (data->worker->write_lock);
|
||||
data->worker->flush_pending = FALSE;
|
||||
g_mutex_unlock (data->worker->write_lock);
|
||||
|
||||
/* OK, cool, finally kick off the next write */
|
||||
maybe_write_next_message (data->worker);
|
||||
|
||||
@ -1207,6 +1214,10 @@ message_written (GDBusWorker *worker,
|
||||
worker->write_pending_flushes = g_list_delete_link (worker->write_pending_flushes, l);
|
||||
}
|
||||
}
|
||||
if (flushers != NULL)
|
||||
{
|
||||
worker->flush_pending = TRUE;
|
||||
}
|
||||
g_mutex_unlock (worker->write_lock);
|
||||
|
||||
if (flushers != NULL)
|
||||
@ -1341,7 +1352,7 @@ static gboolean
|
||||
write_message_in_idle_cb (gpointer user_data)
|
||||
{
|
||||
GDBusWorker *worker = user_data;
|
||||
if (worker->num_writes_pending == 0)
|
||||
if (worker->num_writes_pending == 0 && !worker->flush_pending)
|
||||
maybe_write_next_message (worker);
|
||||
return FALSE;
|
||||
}
|
||||
@ -1424,6 +1435,7 @@ _g_dbus_worker_new (GIOStream *stream,
|
||||
worker->stream = g_object_ref (stream);
|
||||
worker->capabilities = capabilities;
|
||||
worker->cancellable = g_cancellable_new ();
|
||||
worker->flush_pending = FALSE;
|
||||
|
||||
worker->frozen = initially_frozen;
|
||||
worker->received_messages_while_frozen = g_queue_new ();
|
||||
|
Loading…
Reference in New Issue
Block a user