Improve thread safety for scene items
Scene items previously were removed by calling obs_sceneitem_destroy, but this proved to be a potential race condition where two different threads could try to destroy the same scene item at the same time. Instead of doing that, reference counting is now used on scene items, and an explicit obs_sceneitem_remove function is used instead for item removal, which sets a 'removed' variable to ensure it can only be called exactly one time.
This commit is contained in:
@@ -53,8 +53,14 @@ void obs_display_destroy(obs_display_t display)
|
||||
|
||||
obs_source_t obs_display_getsource(obs_display_t display, uint32_t channel)
|
||||
{
|
||||
obs_source_t source;
|
||||
assert(channel < MAX_CHANNELS);
|
||||
return display->channels[channel];
|
||||
|
||||
source = display->channels[channel];
|
||||
if (source)
|
||||
obs_source_addref(source);
|
||||
|
||||
return source;
|
||||
}
|
||||
|
||||
void obs_display_setsource(obs_display_t display, uint32_t channel,
|
||||
|
Reference in New Issue
Block a user