mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-05-04 13:23:26 -04:00
UI: Fix possible race condition in DrawSpacingHelpers
The use of GetCurrentSceneItem can lead to a race condition between the graphics thread (where this function will be run) and the main UI thread, as both access the scene list model and iterate through its members which can change during iteration (as there is no lock around its access).
This commit is contained in:
@@ -2461,10 +2461,10 @@ void OBSBasicPreview::DrawSpacingHelpers()
|
||||
|
||||
obs_scene_enum_items(main->GetCurrentScene(), FindSelected, &data);
|
||||
|
||||
if (data.sceneItems.size() > 1)
|
||||
if (data.sceneItems.size() != 1)
|
||||
return;
|
||||
|
||||
OBSSceneItem item = main->GetCurrentSceneItem();
|
||||
OBSSceneItem item = data.sceneItems[0];
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user