[gnome-desktop] [gnome-bg] Be sure to unreference the file_monitor object during dispose
- From: Thomas Wood <thos src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-desktop] [gnome-bg] Be sure to unreference the file_monitor object during dispose
- Date: Wed, 11 Aug 2010 15:20:56 +0000 (UTC)
commit cbed80b9b6fa07b27d828a9b0a05f12c03449fed
Author: Thomas Wood <thomas wood intel com>
Date: Wed Aug 11 15:50:05 2010 +0100
[gnome-bg] Be sure to unreference the file_monitor object during dispose
Add a dispose handler and unreference the file_monitor object in it. The
clear_cache function is also moved to dispose since it will unreference the
pixbuf_cache object.
libgnome-desktop/gnome-bg.c | 18 ++++++++++++++++--
1 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/libgnome-desktop/gnome-bg.c b/libgnome-desktop/gnome-bg.c
index e176334..47493d2 100644
--- a/libgnome-desktop/gnome-bg.c
+++ b/libgnome-desktop/gnome-bg.c
@@ -451,6 +451,21 @@ gnome_bg_init (GnomeBG *bg)
}
static void
+gnome_bg_dispose (GObject *object)
+{
+ GnomeBG *bg = GNOME_BG (object);
+
+ if (bg->file_monitor) {
+ g_object_unref (bg->file_monitor);
+ bg->file_monitor = NULL;
+ }
+
+ clear_cache (bg);
+
+ G_OBJECT_CLASS (gnome_bg_parent_class)->dispose (object);
+}
+
+static void
gnome_bg_finalize (GObject *object)
{
GnomeBG *bg = GNOME_BG (object);
@@ -475,8 +490,6 @@ gnome_bg_finalize (GObject *object)
bg->filename = NULL;
}
- clear_cache (bg);
-
G_OBJECT_CLASS (gnome_bg_parent_class)->finalize (object);
}
@@ -485,6 +498,7 @@ gnome_bg_class_init (GnomeBGClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ object_class->dispose = gnome_bg_dispose;
object_class->finalize = gnome_bg_finalize;
signals[CHANGED] = g_signal_new ("changed",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]