Fix window resize not always working

Change doresize to atomic_flag to prevent race condition
This commit is contained in:
ts-korhonen
2021-12-17 22:15:21 +02:00
parent 3a5c0383c2
commit 805638ddd8
6 changed files with 22 additions and 18 deletions

View File

@@ -18,6 +18,7 @@
#include <inttypes.h>
#include <dlfcn.h>
#include <wchar.h>
#include <stdatomic.h>
#include <86box/86box.h>
#include <86box/keyboard.h>
@@ -531,12 +532,11 @@ main_thread(void *param)
SDL_Delay(1);
/* If needed, handle a screen resize. */
if (doresize && !video_fullscreen && !is_quit) {
if (!atomic_flag_test_and_set(&doresize) && !video_fullscreen && !is_quit) {
if (vid_resize & 2)
plat_resize(fixed_size_x, fixed_size_y);
else
plat_resize(scrnsz_x, scrnsz_y);
doresize = 0;
}
}