From 5674327297af8d00d44871aff1a36abfc4465dcd Mon Sep 17 00:00:00 2001 From: Emma Anholt Date: Thu, 23 Apr 2026 16:40:26 -0700 Subject: [PATCH] screenshot-layer: Wait on the fence before fallible operations. We want to be sure that the fence isn't destroyed before we've waited on it, so do that before the fallible fs/png operations. Part-of: --- src/vulkan/screenshot-layer/screenshot.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/vulkan/screenshot-layer/screenshot.cpp b/src/vulkan/screenshot-layer/screenshot.cpp index f681a969d9f..c4834221f2c 100644 --- a/src/vulkan/screenshot-layer/screenshot.cpp +++ b/src/vulkan/screenshot-layer/screenshot.cpp @@ -798,6 +798,9 @@ void writePNG(void *job, void *gdata, UNUSED int thread_index) { int matrixSize = localHeight * rowPitch; strcpy(tmpFilename, threadData->filename); strcat(tmpFilename, tmpStr); + + device_data->vtable.WaitForFences(device_data->device, 1, &threadData->cleanup.fence, VK_TRUE, UINT64_MAX); + file = fopen(tmpFilename, "wb"); //create file for output if (!file) { LOG(ERROR, "Failed to open output file, '%s', error(%d): %s\n", tmpFilename, errno, strerror(errno)); @@ -818,7 +821,6 @@ void writePNG(void *job, void *gdata, UNUSED int thread_index) { LOG(ERROR, "setjmp() failed\n"); goto cleanup; } - device_data->vtable.WaitForFences(device_data->device, 1, &threadData->cleanup.fence, VK_TRUE, UINT64_MAX); threadData->pFramebuffer += threadData->srLayout.offset; start_time = get_time();