How to reliably call gdk_pixbuf_get_from_window()

This is a followup for Screenshot test helper has issues with synchronizing rendering (assertion in _cairo_surface_has_mime_data). I am still getting this assertion for a few of my tests that take screenshots:

cairo_surface_mark_dirty_rectangle: Assertion `! _cairo_surface_has_mime_data (surface)' failed

It is the call to gdk_pixbuf_get_from_window that sometimes fails with this assertion. Unless this is a bug that is already fixed later, what would be things to do beforehand to ensure that this assertion is not triggered.

To me it sounds like there is a bug. I am not mucking with gtk internals and the docs for cairo_surface_mark_dirty() hint that something should have called cairo_surface_flush but didn’t.

The docs for gdk_pixbuf_get_from_window describe how the function can fail, but unfortunately it is not failinf but terminating the test (the assertion triggers abort()).

When I compare cases the work and those that fail, I see no difference from the gtk pov. The windows are realized, mapped and visible.

I am using gtk+3.24.2-3 on debian.

I think this is because of this change:
I am trying to verify, but right now I can’t build the gtk-3-24 branch (

Hi @Stefan_Sauer , :slightly_smiling_face:

Which version of Debian are you using ?

I am using debian testing. Looks like it expects some wayland dependency that I don’t have, but it does not check either:

$ git grep xdg_wm_base_pong
gdk/wayland/gdkdisplay-wayland.c:  xdg_wm_base_pong (xdg_wm_base, serial);
$ find . -name "*.h" -exec grep -Hn "xdg_wm_base_pong" {} \;
$ find /usr/include/ -name "*.h" -exec grep -Hn "xdg_wm_base_pong" {} \;