[gtk+/gtk-3-22] ComboBox: list: Don’t leak path on expand/collapse



commit 34cd1e3e5e483a000f102569abb6ecdce161f829
Author: Daniel Boles <dboles src gnome org>
Date:   Thu Oct 5 01:31:39 2017 +0100

    ComboBox: list: Don’t leak path on expand/collapse
    
    Determining that we clicked on the expander means that we had a valid
    path, so we still need to free that, even though we’re not selecting it.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=788505

 gtk/gtkcombobox.c |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c
index 23fc10e..d001c5c 100644
--- a/gtk/gtkcombobox.c
+++ b/gtk/gtkcombobox.c
@@ -3187,21 +3187,21 @@ gtk_combo_box_list_button_released (GtkWidget      *widget,
   /* Don’t select/close after clicking row’s expander. cell_area excludes that */
   gtk_tree_view_get_cell_area (GTK_TREE_VIEW (priv->tree_view),
                                path, column, &cell_area);
-  if (x < cell_area.x || x >= cell_area.x + cell_area.width)
-    return TRUE;
+  if (x >= cell_area.x && x < cell_area.x + cell_area.width)
+    {
+      gtk_tree_model_get_iter (priv->model, &iter, path);
 
-  gtk_tree_model_get_iter (priv->model, &iter, path);
+      /* Use iter before popdown, as mis-users like GtkFileChooserButton alter the
+       * model during notify::popped-up, which means the iterator becomes invalid.
+       */
+      if (tree_column_row_is_sensitive (combo_box, &iter))
+        gtk_combo_box_set_active_internal (combo_box, path);
 
-  /* Use iter before popdown, as mis-users like GtkFileChooserButton alter the
-   * model during notify::popped-up, which means the iterator becomes invalid.
-   */
-  if (tree_column_row_is_sensitive (combo_box, &iter))
-    gtk_combo_box_set_active_internal (combo_box, path);
+      gtk_combo_box_popdown (combo_box);
+    }
 
   gtk_tree_path_free (path);
 
-  gtk_combo_box_popdown (combo_box);
-
   return TRUE;
 }
 


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