[PATCH x11spice] Fix a bug in the tests.

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

 



We were overly dependent on timing for success; now we
deliberately wait for our GC and drawing to finish.

Signed-off-by: Jeremy White <jwhite@xxxxxxxxxxxxxxx>
---
 src/tests/xcb.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/src/tests/xcb.c b/src/tests/xcb.c
index 6be4a69b..709cdfd4 100644
--- a/src/tests/xcb.c
+++ b/src/tests/xcb.c
@@ -82,6 +82,8 @@ int xcb_draw_grid(const char *display)
     xcb_gcontext_t red_fg;
     xcb_gcontext_t green_fg;
 
+    xcb_void_cookie_t cookie;
+
     xcb_rectangle_t red_rectangles[32];
     xcb_rectangle_t green_rectangles[32];
 
@@ -96,19 +98,24 @@ int xcb_draw_grid(const char *display)
     red_fg = xcb_generate_id(c);
     lookup_color(c, screen, "red", &pixels[0]);
     pixels[1] = 0;
-    xcb_create_gc(c, red_fg, screen->root, XCB_GC_FOREGROUND, pixels);
+    cookie = xcb_create_gc_checked(c, red_fg, screen->root, XCB_GC_FOREGROUND, pixels);
+    xcb_request_check(c, cookie);
 
     green_fg = xcb_generate_id(c);
     lookup_color(c, screen, "green", &pixels[0]);
     pixels[1] = 0;
-    xcb_create_gc(c, green_fg, screen->root, XCB_GC_FOREGROUND, pixels);
+    cookie = xcb_create_gc_checked(c, green_fg, screen->root, XCB_GC_FOREGROUND, pixels);
+    xcb_request_check(c, cookie);
 
     create_rectangles(red_rectangles, green_rectangles, screen->width_in_pixels,
                       screen->height_in_pixels);
 
     /* We draw the rectangles */
-    xcb_poly_fill_rectangle_checked(c, screen->root, red_fg, 32, red_rectangles);
-    xcb_poly_fill_rectangle_checked(c, screen->root, green_fg, 32, green_rectangles);
+    cookie = xcb_poly_fill_rectangle_checked(c, screen->root, red_fg, 32, red_rectangles);
+    xcb_request_check(c, cookie);
+
+    cookie = xcb_poly_fill_rectangle_checked(c, screen->root, green_fg, 32, green_rectangles);
+    xcb_request_check(c, cookie);
 
     /* We flush the request */
     xcb_flush(c);
-- 
2.11.0

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]