aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCourtney Goeltzenleuchter <courtney@LunarG.com>2015-04-27 14:56:34 -0600
committerCourtney Goeltzenleuchter <courtney@LunarG.com>2015-04-29 11:25:22 -0600
commitb7e227098fcd7f33a665c5aa3ca59d8c30da8ac0 (patch)
tree65415bbf87bb7a274d273c60a81adeb67207b178
parent29029f85423281a4ba8c03461e654cfcee5eaac4 (diff)
downloadusermoji-b7e227098fcd7f33a665c5aa3ca59d8c30da8ac0.tar.xz
cube: Disable rendering once we enter cleanup
Code was getting a segfault after clicking on the close window button and a refresh is attempted as things are getting shut down. If we use same demo->prepare flag to indicate rendering is ready during shutdown we avoid the issue.
-rw-r--r--demos/cube.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/demos/cube.c b/demos/cube.c
index d072a3c6..37ff8a4b 100644
--- a/demos/cube.c
+++ b/demos/cube.c
@@ -1609,8 +1609,8 @@ static void demo_prepare(struct demo *demo)
#ifdef _WIN32
static void demo_run(struct demo *demo)
{
- if (!demo->prepared)
- return;
+ if (!demo->prepared)
+ return;
// Wait for work to finish before updating MVP.
vkDeviceWaitIdle(demo->device);
demo_update_data_buffer(demo);
@@ -1994,6 +1994,8 @@ static void demo_cleanup(struct demo *demo)
{
uint32_t i, j;
+ demo->prepared = false;
+
vkDestroyObject(demo->device, VK_OBJECT_TYPE_DESCRIPTOR_SET, demo->desc_set);
vkDestroyObject(demo->device, VK_OBJECT_TYPE_DESCRIPTOR_POOL, demo->desc_pool);