[gtk/wip/otte/for-master: 1/3] listbase: Fix leak



commit aa38fc712fa76c60ccc13b75c6de9243b55748b3
Author: Benjamin Otte <otte redhat com>
Date:   Wed Jun 3 17:49:04 2020 +0200

    listbase: Fix leak
    
    We were leaking the temporary tracker here.

 gtk/gtklistbase.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtklistbase.c b/gtk/gtklistbase.c
index 8ec9bc8784..c163ccf6fa 100644
--- a/gtk/gtklistbase.c
+++ b/gtk/gtklistbase.c
@@ -1460,6 +1460,7 @@ gtk_list_base_grab_focus_on_item (GtkListBase *self,
 {
   GtkListBasePrivate *priv = gtk_list_base_get_instance_private (self);
   GtkListItemManagerItem *item;
+  gboolean success;
 
   item = gtk_list_item_manager_get_nth (priv->item_manager, pos, NULL);
   if (item == NULL)
@@ -1478,17 +1479,18 @@ gtk_list_base_grab_focus_on_item (GtkListBase *self,
       item = gtk_list_item_manager_get_nth (priv->item_manager, pos, NULL);
       g_assert (item->widget);
 
-      if (!gtk_widget_grab_focus (item->widget))
-          return FALSE;
+      success = gtk_widget_grab_focus (item->widget);
 
       gtk_list_item_tracker_free (priv->item_manager, tracker);
     }
   else
     {
-      if (!gtk_widget_grab_focus (item->widget))
-          return FALSE;
+      success = gtk_widget_grab_focus (item->widget);
     }
 
+  if (!success)
+    return FALSE;
+
   if (select)
     gtk_list_base_select_item (self, pos, modify, extend);
 


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