[eog] Move clearing of mutexes from dispose into finalize handlers
- From: Felix Riemann <friemann src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [eog] Move clearing of mutexes from dispose into finalize handlers
- Date: Sun, 19 Feb 2012 13:27:50 +0000 (UTC)
commit 7f2f92bfbdb1559008ba15116c7a8309de0b8ad8
Author: Felix Riemann <friemann gnome org>
Date: Sun Feb 19 14:24:32 2012 +0100
Move clearing of mutexes from dispose into finalize handlers
We cannot guard the new-style GMutexes against repeated clearing in
dispose handlers. So move them into finalize handlers to prevent that
scenario (which causes double frees) from happening.
src/eog-image.c | 13 +++++++++++++
src/eog-list-store.c | 11 ++++++++++-
2 files changed, 23 insertions(+), 1 deletions(-)
---
diff --git a/src/eog-image.c b/src/eog-image.c
index a2d6c6b..fd2b2c0 100644
--- a/src/eog-image.c
+++ b/src/eog-image.c
@@ -209,11 +209,24 @@ eog_image_dispose (GObject *object)
}
static void
+eog_image_finalize (GObject *object)
+{
+ EogImagePrivate *priv;
+
+ priv = EOG_IMAGE (object)->priv;
+
+ g_mutex_clear (&priv->status_mutex);
+
+ G_OBJECT_CLASS (eog_image_parent_class)->finalize (object);
+}
+
+static void
eog_image_class_init (EogImageClass *klass)
{
GObjectClass *object_class = (GObjectClass*) klass;
object_class->dispose = eog_image_dispose;
+ object_class->finalize = eog_image_finalize;
signals[SIGNAL_SIZE_PREPARED] =
g_signal_new ("size-prepared",
diff --git a/src/eog-list-store.c b/src/eog-list-store.c
index 7e5c3f8..b6c907b 100644
--- a/src/eog-list-store.c
+++ b/src/eog-list-store.c
@@ -70,9 +70,17 @@ eog_list_store_dispose (GObject *object)
store->priv->missing_image = NULL;
}
+ G_OBJECT_CLASS (eog_list_store_parent_class)->dispose (object);
+}
+
+static void
+eog_list_store_finalize (GObject *object)
+{
+ EogListStore *store = EOG_LIST_STORE (object);
+
g_mutex_clear (&store->priv->mutex);
- G_OBJECT_CLASS (eog_list_store_parent_class)->dispose (object);
+ G_OBJECT_CLASS (eog_list_store_parent_class)->finalize (object);
}
static void
@@ -81,6 +89,7 @@ eog_list_store_class_init (EogListStoreClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->dispose = eog_list_store_dispose;
+ object_class->finalize = eog_list_store_finalize;
g_type_class_add_private (object_class, sizeof (EogListStorePrivate));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]