mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-02-01 18:12:12 -05:00
This race condition is caused when one thread creates a swap chain, which calls OBS_CreateSwapchainKHR, at the same time another thread calls OBS_CreateImageView. OBS_CreateSwapchainKHR allocates swap data, publishes this into the data->swaps linked list, then initializes it. Meanwhile, OBS_CreateImageView is iterating the swaps linked list, to see if the image matches any swap chain images. Due to the order in OBS_CreateSwapchainKHR, there's no guarantee this data is initialized so it often ends up running out of bounds on the swap_images array. The fix is simply to defer the swap data publish to after init.