mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 04:58:05 +02:00
screenshot-layer: Fix rename() to final png before the file is flushed.
If the app exited before the thread was finished, then we might get an incomplete png at the final filename. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41299>
This commit is contained in:
parent
a2f4977e7f
commit
0fc106823c
1 changed files with 5 additions and 0 deletions
|
|
@ -859,6 +859,11 @@ void *writePNG(void *data) {
|
|||
png_write_end(png, NULL); // End image writing
|
||||
free(row_pointer);
|
||||
|
||||
// Close before renaming, to ensure the writes are flushed (in case of app
|
||||
// exit without vkDestroyDevice() to join our thread).
|
||||
fclose(file);
|
||||
file = NULL;
|
||||
|
||||
// Rename file, indicating completion, client should be
|
||||
// checking for the final file exists.
|
||||
if (rename(tmpFilename, filename) != 0 )
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue