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:
parent
fa9b7b042f
commit
8d82263513
1 changed files with 2 additions and 2 deletions
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue