screenshot-layer: Wait on the fence before fallible operations.
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

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: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41299>
This commit is contained in:
Emma Anholt 2026-04-23 16:40:26 -07:00 committed by Marge Bot
parent 25b2865146
commit 5674327297

View file

@ -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();