From 73477419e89e73c4af49c3f2d88493af4f57ce90 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Wed, 4 Mar 2009 10:45:10 +0000 Subject: [PATCH] =?UTF-8?q?Bug=20573970=20=E2=80=93=20crash=20in=20gunixvo?= =?UTF-8?q?lumemonitor:update=5Fmounts=20when=20unmounting?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 2009-03-04 Alexander Larsson Bug 573970 – crash in gunixvolumemonitor:update_mounts when unmounting * gunionvolumemonitor.c: (g_union_volume_monitor_dispose): Run dispose on child monitors when disposing. * gunixvolumemonitor.c: Remove all volumes and mount on dispose to avoid circular dependencies not freeing the monitor svn path=/trunk/; revision=7957 --- gio/ChangeLog | 12 ++++++++++++ gio/gunionvolumemonitor.c | 11 ++++++++++- gio/gunixvolumemonitor.c | 18 ++++++++++++++++++ 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/gio/ChangeLog b/gio/ChangeLog index 594f71eaf..6df6bc295 100644 --- a/gio/ChangeLog +++ b/gio/ChangeLog @@ -1,3 +1,15 @@ +2009-03-04 Alexander Larsson + + Bug 573970 – crash in gunixvolumemonitor:update_mounts when unmounting + + * gunionvolumemonitor.c: + (g_union_volume_monitor_dispose): + Run dispose on child monitors when disposing. + + * gunixvolumemonitor.c: + Remove all volumes and mount on dispose to avoid circular + dependencies not freeing the monitor + 2009-03-03 Alexander Larsson Bug 561172 – gnome-open fails on local URIs with anchors diff --git a/gio/gunionvolumemonitor.c b/gio/gunionvolumemonitor.c index 4115c3466..12ef95ca1 100644 --- a/gio/gunionvolumemonitor.c +++ b/gio/gunionvolumemonitor.c @@ -80,11 +80,20 @@ static void g_union_volume_monitor_dispose (GObject *object) { GUnionVolumeMonitor *monitor; - + GVolumeMonitor *child_monitor; + GList *l; + monitor = G_UNION_VOLUME_MONITOR (object); g_static_rec_mutex_lock (&the_volume_monitor_mutex); the_volume_monitor = NULL; + + for (l = monitor->monitors; l != NULL; l = l->next) + { + child_monitor = l->data; + g_object_run_dispose (G_OBJECT (child_monitor)); + } + g_static_rec_mutex_unlock (&the_volume_monitor_mutex); G_OBJECT_CLASS (g_union_volume_monitor_parent_class)->dispose (object); diff --git a/gio/gunixvolumemonitor.c b/gio/gunixvolumemonitor.c index 54f101703..7592ca88a 100644 --- a/gio/gunixvolumemonitor.c +++ b/gio/gunixvolumemonitor.c @@ -90,6 +90,23 @@ g_unix_volume_monitor_finalize (GObject *object) G_OBJECT_CLASS (g_unix_volume_monitor_parent_class)->finalize (object); } +static void +g_unix_volume_monitor_dispose (GObject *object) +{ + GUnixVolumeMonitor *monitor; + + monitor = G_UNIX_VOLUME_MONITOR (object); + g_list_foreach (monitor->volumes, (GFunc)g_object_unref, NULL); + g_list_free (monitor->volumes); + monitor->volumes = NULL; + + g_list_foreach (monitor->mounts, (GFunc)g_object_unref, NULL); + g_list_free (monitor->mounts); + monitor->mounts = NULL; + + G_OBJECT_CLASS (g_unix_volume_monitor_parent_class)->dispose (object); +} + static GList * get_mounts (GVolumeMonitor *volume_monitor) { @@ -170,6 +187,7 @@ g_unix_volume_monitor_class_init (GUnixVolumeMonitorClass *klass) GNativeVolumeMonitorClass *native_class = G_NATIVE_VOLUME_MONITOR_CLASS (klass); gobject_class->finalize = g_unix_volume_monitor_finalize; + gobject_class->dispose = g_unix_volume_monitor_dispose; monitor_class->get_mounts = get_mounts; monitor_class->get_volumes = get_volumes;