[gtk: 1/2] snapshot: Fix assert in inhibition



commit b4af23be23f04c02c9ce633c033fc145349ca45b
Author: Alexander Larsson <alexl redhat com>
Date:   Thu Jun 4 12:37:48 2020 +0200

    snapshot: Fix assert in inhibition
    
    In https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/2027 i was getting
    
    Bail out! ERROR:../testsuite/reftests/reftest-snapshot.c:212:reftest_uninhibit_snapshot: assertion 
failed: (inhibit_count > 0)
    
    In (for example the box-shadow-changes-modify-clip reftest. I can reproduce this (on master) with:
    
    ```
    $ xvfb-run -a -s "-screen 0 1024x768x24" meson test --suite gtk:reftest "reftest 
box-shadow-changes-modify-clip.ui"
    ...
    1/1 gtk:reftest / reftest box-shadow-changes-modify-clip.ui ERROR          0.77s
    ``
    
    Fix this by re-inhibiting if we didn't draw anything, or we will get an assert the next paint.

 testsuite/reftests/reftest-snapshot.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/testsuite/reftests/reftest-snapshot.c b/testsuite/reftests/reftest-snapshot.c
index 5ea2262fe5..2d870f66e4 100644
--- a/testsuite/reftests/reftest-snapshot.c
+++ b/testsuite/reftests/reftest-snapshot.c
@@ -231,7 +231,10 @@ draw_paintable (GdkPaintable *paintable,
   cairo_t *cr;
 
   if (!reftest_uninhibit_snapshot ())
-    return;
+    {
+      reftest_inhibit_snapshot();
+      return;
+    }
 
   snapshot = gtk_snapshot_new ();
   gdk_paintable_snapshot (paintable,
@@ -244,7 +247,10 @@ draw_paintable (GdkPaintable *paintable,
    * the invalidations were only side effects of resizes.
    */
   if (node == NULL)
-    return;
+    {
+      reftest_inhibit_snapshot();
+      return;
+    }
 
   surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
                                         gdk_paintable_get_intrinsic_width (paintable),


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]