columnview: Fix refcounting woes
authorBenjamin Otte <otte@redhat.com>
Sat, 12 Aug 2023 20:14:11 +0000 (22:14 +0200)
committerMatthias Clasen <mclasen@redhat.com>
Thu, 24 Aug 2023 14:19:49 +0000 (10:19 -0400)
The new code did not deal with the GtkScrollInfo properly.

Related: #6002

gtk/gtkcolumnview.c

index c3db9d0e7fa50017a8362857a5a70c00c8663f3a..f95738bfce5ca5603ccef0042b8832e6bca871b3 100644 (file)
@@ -1798,6 +1798,8 @@ gtk_column_view_scroll_to_column (GtkColumnView       *self,
                                                        gtk_adjustment_get_page_size (self->hadjustment));
 
   gtk_adjustment_set_value (self->hadjustment, new_value);
+
+  g_clear_pointer (&scroll_info, gtk_scroll_info_unref);
 }
 
 void
@@ -2214,9 +2216,14 @@ gtk_column_view_scroll_to (GtkColumnView       *self,
   if (column && (flags & GTK_LIST_SCROLL_FOCUS))
     gtk_column_view_set_focus_column (self, column, FALSE);
 
-  gtk_list_view_scroll_to (self->listview, pos, flags, scroll);
+  gtk_list_view_scroll_to (self->listview,
+                           pos,
+                           flags,
+                           scroll ? gtk_scroll_info_ref (scroll) : NULL);
 
   if (column)
     gtk_column_view_scroll_to_column (self, column, scroll);
+  else
+    g_clear_pointer (&scroll, gtk_scroll_info_unref);
 }