Merge branch 'teardown-cleanup-2' into 'master'

Treeview teardown cleanup

See merge request GNOME/gtk!1872
This commit is contained in:
Matthias Clasen 2020-05-11 15:23:40 +00:00
commit 597665517c
2 changed files with 17 additions and 4 deletions

View File

@ -644,6 +644,7 @@ static void gtk_tree_view_get_property (GObject *object,
/* gtkwidget signals */ /* gtkwidget signals */
static void gtk_tree_view_realize (GtkWidget *widget); static void gtk_tree_view_realize (GtkWidget *widget);
static void gtk_tree_view_unrealize (GtkWidget *widget); static void gtk_tree_view_unrealize (GtkWidget *widget);
static void gtk_tree_view_unroot (GtkWidget *widget);
static void gtk_tree_view_map (GtkWidget *widget); static void gtk_tree_view_map (GtkWidget *widget);
static void gtk_tree_view_measure (GtkWidget *widget, static void gtk_tree_view_measure (GtkWidget *widget,
GtkOrientation orientation, GtkOrientation orientation,
@ -1021,6 +1022,7 @@ gtk_tree_view_class_init (GtkTreeViewClass *class)
widget_class->map = gtk_tree_view_map; widget_class->map = gtk_tree_view_map;
widget_class->realize = gtk_tree_view_realize; widget_class->realize = gtk_tree_view_realize;
widget_class->unrealize = gtk_tree_view_unrealize; widget_class->unrealize = gtk_tree_view_unrealize;
widget_class->unroot = gtk_tree_view_unroot;
widget_class->measure = gtk_tree_view_measure; widget_class->measure = gtk_tree_view_measure;
widget_class->size_allocate = gtk_tree_view_size_allocate; widget_class->size_allocate = gtk_tree_view_size_allocate;
widget_class->snapshot = gtk_tree_view_snapshot; widget_class->snapshot = gtk_tree_view_snapshot;
@ -2311,6 +2313,19 @@ gtk_tree_view_unrealize (GtkWidget *widget)
GTK_WIDGET_CLASS (gtk_tree_view_parent_class)->unrealize (widget); GTK_WIDGET_CLASS (gtk_tree_view_parent_class)->unrealize (widget);
} }
static void
gtk_tree_view_unroot (GtkWidget *widget)
{
GtkTreeView *tree_view = GTK_TREE_VIEW (widget);
/* break ref cycles */
g_clear_pointer (&tree_view->scroll_to_path, gtk_tree_row_reference_free);
g_clear_pointer (&tree_view->drag_dest_row, gtk_tree_row_reference_free);
g_clear_pointer (&tree_view->top_row, gtk_tree_row_reference_free);
GTK_WIDGET_CLASS (gtk_tree_view_parent_class)->unroot (widget);
}
/* GtkWidget::get_preferred_height helper */ /* GtkWidget::get_preferred_height helper */
static void static void
gtk_tree_view_update_height (GtkTreeView *tree_view) gtk_tree_view_update_height (GtkTreeView *tree_view)

View File

@ -468,8 +468,7 @@ main (int argc, char **argv)
g_test_add_func ("/template/GtkColorChooserDialog/show", test_color_chooser_dialog_show); g_test_add_func ("/template/GtkColorChooserDialog/show", test_color_chooser_dialog_show);
g_test_add_func ("/template/GtkFileChooserWidget/basic", test_file_chooser_widget_basic); g_test_add_func ("/template/GtkFileChooserWidget/basic", test_file_chooser_widget_basic);
g_test_add_func ("/template/GtkFileChooserDialog/basic", test_file_chooser_dialog_basic); g_test_add_func ("/template/GtkFileChooserDialog/basic", test_file_chooser_dialog_basic);
if (0) g_test_add_func ("/template/GtkFileChooserDialog/show", test_file_chooser_dialog_show);
g_test_add_func ("/template/GtkFileChooserDialog/show", test_file_chooser_dialog_show);
g_test_add_func ("/template/GtkFileChooserButton/basic", test_file_chooser_button_basic); g_test_add_func ("/template/GtkFileChooserButton/basic", test_file_chooser_button_basic);
g_test_add_func ("/template/GtkFontButton/basic", test_font_button_basic); g_test_add_func ("/template/GtkFontButton/basic", test_font_button_basic);
g_test_add_func ("/template/GtkFontChooserWidget/basic", test_font_chooser_widget_basic); g_test_add_func ("/template/GtkFontChooserWidget/basic", test_font_chooser_widget_basic);
@ -480,8 +479,7 @@ main (int argc, char **argv)
g_test_add_func ("/template/GtkPageSetupUnixDialog/basic", test_page_setup_unix_dialog_basic); g_test_add_func ("/template/GtkPageSetupUnixDialog/basic", test_page_setup_unix_dialog_basic);
g_test_add_func ("/template/GtkPageSetupUnixDialog/show", test_page_setup_unix_dialog_show); g_test_add_func ("/template/GtkPageSetupUnixDialog/show", test_page_setup_unix_dialog_show);
g_test_add_func ("/template/GtkPrintUnixDialog/basic", test_print_unix_dialog_basic); g_test_add_func ("/template/GtkPrintUnixDialog/basic", test_print_unix_dialog_basic);
if (0) g_test_add_func ("/template/GtkPrintUnixDialog/show", test_print_unix_dialog_show);
g_test_add_func ("/template/GtkPrintUnixDialog/show", test_print_unix_dialog_show);
#endif #endif
return g_test_run(); return g_test_run();