[devhelp/wip/swilmet/maintenance: 15/21] book: clear object in dispose()
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [devhelp/wip/swilmet/maintenance: 15/21] book: clear object in dispose()
- Date: Sat, 23 May 2015 18:33:25 +0000 (UTC)
commit 3439f3abd4ff0ec42ee105f8a031cdfa29fd1a1e
Author: Sébastien Wilmet <swilmet gnome org>
Date: Sat May 23 17:53:43 2015 +0200
book: clear object in dispose()
Releasing object references should be done in dispose(), not finalize().
src/dh-book.c | 15 +++++++++++++--
1 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/src/dh-book.c b/src/dh-book.c
index cb8e828..2f4019c 100644
--- a/src/dh-book.c
+++ b/src/dh-book.c
@@ -88,6 +88,18 @@ static void unref_node_link (GNode *node,
static guint signals[BOOK_LAST_SIGNAL] = { 0 };
static void
+dh_book_dispose (GObject *object)
+{
+ DhBookPrivate *priv;
+
+ priv = dh_book_get_instance_private (DH_BOOK (object));
+
+ g_clear_object (&priv->monitor);
+
+ G_OBJECT_CLASS (dh_book_parent_class)->dispose (object);
+}
+
+static void
dh_book_finalize (GObject *object)
{
DhBookPrivate *priv;
@@ -108,8 +120,6 @@ dh_book_finalize (GObject *object)
g_list_free_full (priv->completions, g_free);
- g_clear_object (&priv->monitor);
-
g_free (priv->language);
g_free (priv->title);
@@ -126,6 +136,7 @@ dh_book_class_init (DhBookClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ object_class->dispose = dh_book_dispose;
object_class->finalize = dh_book_finalize;
signals[BOOK_ENABLED] =
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]