[glib] _g_dbus_worker_new: hold a ref until we have done the initial read
- From: David Zeuthen <davidz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] _g_dbus_worker_new: hold a ref until we have done the initial read
- Date: Fri, 16 Sep 2011 16:13:57 +0000 (UTC)
commit e34e8a25a04f31e7436af297fced96bbfc4b4f79
Author: Simon McVittie <simon mcvittie collabora co uk>
Date: Mon Sep 12 18:42:36 2011 +0100
_g_dbus_worker_new: hold a ref until we have done the initial read
Otherwise, we could use-after-free the GDBusWorker, if its last-unref
is immediately after _g_dbus_worker_new returns (before the worker thread
does its initial read).
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=651268
Bug-NB: NB#271520
Signed-off-by: Simon McVittie <simon mcvittie collabora co uk>
Signed-off-by: David Zeuthen <davidz redhat com>
gio/gdbusprivate.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/gio/gdbusprivate.c b/gio/gdbusprivate.c
index 4b2243d..87a3b6b 100644
--- a/gio/gdbusprivate.c
+++ b/gio/gdbusprivate.c
@@ -1590,8 +1590,8 @@ _g_dbus_worker_new (GIOStream *stream,
g_source_set_priority (idle_source, G_PRIORITY_DEFAULT);
g_source_set_callback (idle_source,
_g_dbus_worker_do_initial_read,
- worker,
- NULL);
+ _g_dbus_worker_ref (worker),
+ (GDestroyNotify) _g_dbus_worker_unref);
g_source_attach (idle_source, worker->shared_thread_data->context);
g_source_unref (idle_source);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]