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 775470 - GdkWindow does not always unref all GdkFrameClockIdle it creates
GdkWindow does not always unref all GdkFrameClockIdle it creates
Status: RESOLVED DUPLICATE of bug 774915
Product: gtk+
Classification: Platform
Component: Backend: Wayland
3.22.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2016-12-01 14:15 UTC by Massimo
Modified: 2016-12-01 17:30 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Massimo 2016-12-01 14:15:04 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 1
#endif

int
main (int   argc,
      char *argv[])
{
  if (gtk_init_check (&argc, &argv))
    {
      int i;
      for (i = 0; i < ITERATIONS; ++i)
        {
          GtkWidget *dialog;
          dialog = gtk_file_chooser_dialog_new ("Open File",
                                                NULL,
                                                GTK_FILE_CHOOSER_ACTION_OPEN,
                                                "Cancel", GTK_RESPONSE_CANCEL,
                                                NULL);
          gtk_widget_show_all (dialog);
          gtk_widget_destroy (dialog);
        }
    }

  return 0;
}

on Wayland the number of objects alive at exit increases for the 
presence of few GdkFrameClockIdle objects.

The problem is that on Wayland popover GdkWindow have window_type
GDK_WINDOW_SUBSURFACE

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

and gdk_window_destroy (_gdk_window_destroy_hierarchy) does nearly nothing
for this kind of GdkWindow:

https://git.gnome.org/browse/gtk+/tree/gdk/gdkwindow.c?h=gtk-3-22#n2019

in particular it does not unref GdkFrameClockIdle objects it
creates.
Comment 1 Olivier Fourdan 2016-12-01 14:18:24 UTC
(In reply to Massimo from comment #0)
> [...]
> The problem is that on Wayland popover GdkWindow have window_type
> GDK_WINDOW_SUBSURFACE
> 
> and gdk_window_destroy (_gdk_window_destroy_hierarchy) does nearly nothing
> for this kind of GdkWindow:
> [...]

In current master and gtk-3-22 git branch, this is not the case anymore, does commit 893ed4e from bug 774915 help here?
Comment 2 Olivier Fourdan 2016-12-01 14:20:38 UTC
Ah! my bad, the patch is not reviewed/merged yet, so I guess this might be a duplicate of bug 774915, can you try attachment 340598 [details] [review] to see if this helps here as well?
Comment 3 Massimo 2016-12-01 14:24:25 UTC
(In reply to Olivier Fourdan from comment #2)
> Ah! my bad, the patch is not reviewed/merged yet, so I guess this might be a
> duplicate of bug 774915, can you try attachment 340598 [details] [review] [review] to
> see if this helps here as well?

yes that attachment would fix the problem.
Comment 4 Olivier Fourdan 2016-12-01 14:32:06 UTC
With attachment 340598 [details] [review]  I see "GdkFrameClockIdle  ref_count=1" in all cases (ITERATIONS=1, ITERATIONS=2 and even ITERATIONS=100)
Comment 5 Olivier Fourdan 2016-12-01 14:32:23 UTC

*** This bug has been marked as a duplicate of bug 774915 ***
Comment 6 Massimo 2016-12-01 17:30:09 UTC
(In reply to Olivier Fourdan from comment #4)
> With attachment 340598 [details] [review] [review]  I see "GdkFrameClockIdle 
> ref_count=1" in all cases (ITERATIONS=1, ITERATIONS=2 and even
> ITERATIONS=100)

Yes and without that patch there are 5 such lines with
ITERATIONS=1 and 9 with ITERATIONS=2