[gtk] stack: Avoid some ugly unrefs



commit c0c6c877810844620f58e9893f9fa8a54ca80859
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Feb 13 08:40:13 2019 -0500

    stack: Avoid some ugly unrefs
    
    Instead of using the list model api that forces us
    to drop the ref, just work with the list we have.

 gtk/gtkstack.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkstack.c b/gtk/gtkstack.c
index 2030e919f5..633a5ae712 100644
--- a/gtk/gtkstack.c
+++ b/gtk/gtkstack.c
@@ -464,8 +464,7 @@ gtk_stack_pages_is_selected (GtkSelectionModel *model,
   GtkStackPrivate *priv = gtk_stack_get_instance_private (pages->stack);
   GtkStackPage *page;
 
-  page = GTK_STACK_PAGE (g_list_model_get_item (G_LIST_MODEL (model), position));
-  g_object_unref (page);
+  page = g_list_nth_data (priv->children, position);
 
   return page == priv->visible_child;
 }
@@ -484,8 +483,7 @@ gtk_stack_pages_select_item (GtkSelectionModel *model,
   GtkStackPrivate *priv = gtk_stack_get_instance_private (pages->stack);
   GtkStackPage *page;
 
-  page = GTK_STACK_PAGE (g_list_model_get_item (G_LIST_MODEL (model), position));
-  g_object_unref (page);
+  page = g_list_nth_data (priv->children, position);
 
   set_visible_child (pages->stack, page, priv->transition_type, priv->transition_duration);
 


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