After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 774046 - GtkSpinButton does not always unref priv->{up,down}_button
GtkSpinButton does not always unref priv->{up,down}_button
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkSpinButton
3.22.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2016-11-07 09:42 UTC by Massimo
Modified: 2016-11-10 19:47 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Massimo 2016-11-07 09:42:11 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.