[devhelp] BookTree: fix warnings: function called through a non-compatible type



commit 5388bc446731bd8706ba9b880bf08305245d5e4a
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Fri Jan 11 18:56:34 2019 +0100

    BookTree: fix warnings: function called through a non-compatible type

 devhelp/dh-book-tree.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/devhelp/dh-book-tree.c b/devhelp/dh-book-tree.c
index f9bad5cf..6d750b8e 100644
--- a/devhelp/dh-book-tree.c
+++ b/devhelp/dh-book-tree.c
@@ -106,7 +106,9 @@ book_tree_selection_changed_cb (GtkTreeSelection *selection,
 
         if (link != NULL &&
             link != priv->selected_link) {
-                g_clear_pointer (&priv->selected_link, (GDestroyNotify)dh_link_unref);
+                if (priv->selected_link != NULL)
+                        dh_link_unref (priv->selected_link);
+
                 priv->selected_link = dh_link_ref (link);
                 g_signal_emit (tree, signals[LINK_SELECTED], 0, link);
         }
@@ -581,7 +583,9 @@ book_tree_init_selection (DhBookTree *tree)
                 if (link == NULL || dh_link_get_link_type (link) != DH_LINK_TYPE_BOOK)
                         g_warn_if_reached ();
 
-                g_clear_pointer (&priv->selected_link, (GDestroyNotify)dh_link_unref);
+                if (priv->selected_link != NULL)
+                        dh_link_unref (priv->selected_link);
+
                 priv->selected_link = link;
                 gtk_tree_selection_select_iter (selection, &iter);
         }
@@ -718,9 +722,13 @@ dh_book_tree_dispose (GObject *object)
 
         g_clear_object (&priv->profile);
         g_clear_object (&priv->store);
-        g_clear_pointer (&priv->selected_link, (GDestroyNotify)dh_link_unref);
         priv->context_menu = NULL;
 
+        if (priv->selected_link != NULL) {
+                dh_link_unref (priv->selected_link);
+                priv->selected_link = NULL;
+        }
+
         G_OBJECT_CLASS (dh_book_tree_parent_class)->dispose (object);
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]