From 67d3f26427c2bb8f5a436b9447c49e220252b28f Mon Sep 17 00:00:00 2001 From: Arda Coskunses Date: Thu, 19 Jan 2017 10:41:27 -0700 Subject: Vulkaninfo: Vulkaninfo crashes when DISPLAY is invalid On Linux the following command crashes: DISPLAY=foobar ./vulkaninfo This patch fixes this issue. https://github.com/LunarG/VulkanTools/issues/125 Change-Id: Ibb8d7b8b6cb4dc730aab9f5b4311e744c903029b --- demos/vulkaninfo.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/demos/vulkaninfo.c b/demos/vulkaninfo.c index 03a4f703..de685b9c 100644 --- a/demos/vulkaninfo.c +++ b/demos/vulkaninfo.c @@ -884,6 +884,13 @@ static void AppCreateXcbWindow(struct AppInstance *inst) { exit(1); } + int conn_error = xcb_connection_has_error(inst->xcb_connection); + if (conn_error) { + printf("XCB failed to connect to the X server due to error:%d.\nExiting ...\n", conn_error); + fflush(stdout); + exit(1); + } + setup = xcb_get_setup(inst->xcb_connection); iter = xcb_setup_roots_iterator(setup); while (scr-- > 0) { -- cgit v1.2.3