diff --git a/gtk/src/gtk_display_driver_vulkan.cpp b/gtk/src/gtk_display_driver_vulkan.cpp index 70f4f2c4..977ed18f 100644 --- a/gtk/src/gtk_display_driver_vulkan.cpp +++ b/gtk/src/gtk_display_driver_vulkan.cpp @@ -124,11 +124,12 @@ int S9xVulkanDisplayDriver::init() wayland_surface = std::make_unique(); wl_surface *surface = gdk_wayland_window_get_wl_surface(drawing_area->get_window()->gobj()); wl_display *display = gdk_wayland_display_get_wl_display(drawing_area->get_display()->gobj()); + if (!wayland_surface->attach(display, surface, get_metrics(*drawing_area))) - { return -1; - } - context->init_wayland(wayland_surface->display, wayland_surface->child, current_width, current_height); + + if (!context->init_wayland(wayland_surface->display, wayland_surface->child, current_width, current_height)) + return -1; } #endif if (GDK_IS_X11_WINDOW(drawing_area->get_window()->gobj())) @@ -136,7 +137,8 @@ int S9xVulkanDisplayDriver::init() display = gdk_x11_display_get_xdisplay(drawing_area->get_display()->gobj()); xid = gdk_x11_window_get_xid(drawing_area->get_window()->gobj()); - context->init_Xlib(display, xid); + if (!context->init_Xlib(display, xid)) + return -1; } device = context->device; diff --git a/vulkan/vulkan_context.cpp b/vulkan/vulkan_context.cpp index a5b02322..babaa79b 100644 --- a/vulkan/vulkan_context.cpp +++ b/vulkan/vulkan_context.cpp @@ -63,7 +63,13 @@ static vk::UniqueInstance create_instance_preamble(const char *wsi_extension) vk::ApplicationInfo application_info({}, {}, {}, {}, VK_API_VERSION_1_0); vk::InstanceCreateInfo instance_create_info({}, &application_info, {}, extensions); - auto instance = vk::createInstanceUnique(instance_create_info); + vk::UniqueInstance instance; + try { + instance = vk::createInstanceUnique(instance_create_info); + } catch (std::exception &e) { + instance.reset(); + return {}; + } VULKAN_HPP_DEFAULT_DISPATCHER.init(instance.get());