GNOME Bugzilla – Bug 774046
GtkSpinButton does not always unref priv->{up,down}_button
Last modified: 2016-11-10 19:47:24 UTC
After setting GOBJECT_DEBUG=objects comparing the outputs of the following program run with ITERATIONS set to 2 and 1: #include <gtk/gtk.h> #ifndef ITERATIONS #define ITERATIONS 2 #endif int main (int argc, char *argv[]) { if (gtk_init_check (&argc, &argv)) for (gint i = 0; i < ITERATIONS; ++i) { GtkWidget *dialog = gtk_color_chooser_dialog_new ("Open File", NULL); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); } return 0; } the number of objects alive at exit increases for the presence of few GtkIconHelper objects created by GtkSpinButton. g_clear_object -ing &priv->up_button and &priv->down_button in gtk_spin_button_finalize seems to fix the issue (I mean I'm not sure it is the proper way to free these objects, but these are 2 GObjects created once per GtkSpinbutton that are not always destroyed). BTW gtk_css_node_set_parent and gtk_css_node_set_state is called twice for priv->down_button and none for priv->up_button https://git.gnome.org/browse/gtk+/tree/gtk/gtkspinbutton.c?h=gtk-3-22#n825 this second could be a copy/paste bug.