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 774634 - GtkPlacesView does not unref all GDaemonFileEnumerator it references
GtkPlacesView does not unref all GDaemonFileEnumerator it references
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
3.22.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2016-11-17 18:31 UTC by Massimo
Modified: 2016-11-17 18:54 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Massimo 2016-11-17 18:31:25 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[])
{
  int i;

  if (gtk_init_check (&argc, &argv))
    for (i = 0; i < ITERATIONS; ++i)
      {
        GtkWidget *dialog = gtk_file_chooser_dialog_new ("Open File", NULL,
                                                         GTK_FILE_CHOOSER_ACTION_OPEN,
                                                         "Cancel", GTK_RESPONSE_CANCEL,
                                                         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 a GDaemonFileEnumerator.

The object is created here:

https://git.gnome.org/browse/gtk+/tree/gtk/gtkplacesview.c?h=gtk-3-22#n994

Comparing the file_enumerator API usage in gtk/gtkfilesystemmodel.c

https://git.gnome.org/browse/gtk+/tree/gtk/gtkfilesystemmodel.c?h=gtk-3-22#n1282

it seems that 'enumerator' should be unreffed after the call to
g_file_enumerator_next_files_async

https://git.gnome.org/browse/gtk+/tree/gtk/gtkplacesview.c?h=gtk-3-22#n1014
Comment 1 Matthias Clasen 2016-11-17 18:33:20 UTC
Thanks so much for filing all these high-quality bug reports. It is really appreciated!