GtkNotebookPage leaks tab_label widget
Steps to reproduce
- open
gtk4-demo
- immediately close it
- observe that (at least some of) the
GtkLabel
objects allocated inmain.c:add_data_tab()
are not freed
Current behavior
Memory leak.
Expected outcome
No memory leak.
Version information
GTK4 built from 7bee50c4
Additional information
GtkNotebookPage
takes a strong reference to the tab label in gtk_notebook_page_set_property()
. As far as I can tell, that reference is correctly given up in gtk_notebook_page_finalize()
but not in gtk_notebook_remove_tab_label()
.
The following appears to work:
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c
index d326516add..b7d90dc953 100644
--- a/gtk/gtknotebook.c
+++ b/gtk/gtknotebook.c
@@ -4215,6 +4215,7 @@ gtk_notebook_remove_tab_label (GtkNotebook *notebook,
gtk_widget_unparent (page->tab_label);
}
+ g_object_unref (page->tab_label);
page->tab_label = NULL;
}
}