From 8642911db6c4445dafb81002eecefeb46fd9ff58 Mon Sep 17 00:00:00 2001 From: Karl Schultz Date: Tue, 20 Jun 2017 11:27:59 -0600 Subject: demos: Destroy instance after closing Xlib connection In the cube demos, destroy the instance after closing the display system connection. It is possible for the driver to register callback functions with a library like Xlib. If the driver is unloaded when Xlib calls those callback functions, a segfault results. Fixes #1894 Change-Id: Ieb25a00f727c4ac05ff24b41c3582b293abf4b95 --- demos/cube.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'demos/cube.cpp') diff --git a/demos/cube.cpp b/demos/cube.cpp index b4fd7928..3ef4f4ea 100644 --- a/demos/cube.cpp +++ b/demos/cube.cpp @@ -382,7 +382,6 @@ struct Demo { device.waitIdle(); device.destroy(nullptr); inst.destroySurfaceKHR(surface, nullptr); - inst.destroy(nullptr); #if defined(VK_USE_PLATFORM_XLIB_KHR) XDestroyWindow(display, xlib_window); @@ -400,6 +399,8 @@ struct Demo { wl_display_disconnect(display); #elif defined(VK_USE_PLATFORM_MIR_KHR) #endif + + inst.destroy(nullptr); } void create_device() { -- cgit v1.2.3