anv/wsi_x11: Properly report BadDrawable errors to the client
authorJason Ekstrand <jason.ekstrand@intel.com>
Tue, 29 Sep 2015 03:17:00 +0000 (20:17 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Tue, 29 Sep 2015 03:18:41 +0000 (20:18 -0700)
src/vulkan/anv_wsi_x11.c

index f481a017001620e9e5c3559f423a0162bc5eb9df..e5d0a2572aa835752470c35e23f26c3c9d93a3c6 100644 (file)
@@ -73,8 +73,18 @@ x11_get_surface_info(struct anv_wsi_implementation *impl,
       xcb_window_t win = (xcb_window_t)(uintptr_t)vk_window->pPlatformWindow;
 
       xcb_get_geometry_cookie_t cookie = xcb_get_geometry(conn, win);
+      xcb_generic_error_t *err;
       xcb_get_geometry_reply_t *geom = xcb_get_geometry_reply(conn, cookie,
-                                                              NULL);
+                                                              &err);
+      if (!geom) {
+         if (err->error_code == XCB_DRAWABLE) {
+            return vk_error(VK_ERROR_INVALID_HANDLE);
+         } else {
+            return vk_error(VK_ERROR_UNKNOWN);
+         }
+         free(err);
+      }
+
       VkExtent2D extent = { geom->width, geom->height };
       free(geom);