[gvfs/gnome-3-8] Daemon: Ensure monitors are not prematurally finalized.
- From: Tomas Bzatek <tbzatek src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gvfs/gnome-3-8] Daemon: Ensure monitors are not prematurally finalized.
- Date: Tue, 2 Apr 2013 10:17:00 +0000 (UTC)
commit adbe1bade2d3d9ba41c29d745cfa5ae433063554
Author: Philip Langdale <philipl overt org>
Date: Sat Mar 23 22:55:40 2013 -0700
Daemon: Ensure monitors are not prematurally finalized.
If a monitor is being cleaned up due to the backend disappearing,
we could see the monitor being finalized as a result of removing
a subscriber, leading to a segfault as it continues to access
its internal state.
https://bugzilla.gnome.org/show_bug.cgi?id=696479
daemon/gvfsmonitor.c | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/daemon/gvfsmonitor.c b/daemon/gvfsmonitor.c
index 12ec6b9..cdf0dc2 100644
--- a/daemon/gvfsmonitor.c
+++ b/daemon/gvfsmonitor.c
@@ -71,7 +71,14 @@ backend_died (GVfsMonitor *monitor,
GObject *old_backend)
{
Subscriber *subscriber;
-
+
+ /*
+ * Take an extra ref on the monitor because
+ * unsubscribing may lead to the last ref
+ * being released.
+ */
+ g_object_ref (G_OBJECT (monitor));
+
monitor->priv->backend = NULL;
while (monitor->priv->subscribers != NULL)
@@ -79,6 +86,8 @@ backend_died (GVfsMonitor *monitor,
subscriber = monitor->priv->subscribers->data;
unsubscribe (subscriber);
}
+
+ g_object_unref (G_OBJECT (monitor));
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]