inst->xcb_connection = xcb_connect(NULL, &scr);
int conn_error = xcb_connection_has_error(inst->xcb_connection);
if (conn_error) {
- fprintf(stderr, "XCB failed to connect to the X server due to error:%d.\nExiting ...\n", conn_error);
+ fprintf(stderr, "XCB failed to connect to the X server due to error:%d.\n", conn_error);
fflush(stderr);
- exit(1);
+ inst->xcb_connection = NULL;
}
setup = xcb_get_setup(inst->xcb_connection);
}
static void AppCreateXcbSurface(struct AppInstance *inst) {
+ if (!inst->xcb_connection) {
+ return;
+ }
+
VkResult U_ASSERT_ONLY err;
VkXcbSurfaceCreateInfoKHR xcb_createInfo;
xcb_createInfo.sType = VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR;
}
static void AppDestroyXcbWindow(struct AppInstance *inst) {
+ if (!inst->xcb_connection) {
+ return; // Nothing to destroy
+ }
+
xcb_destroy_window(inst->xcb_connection, inst->xcb_window);
xcb_disconnect(inst->xcb_connection);
}