Use obs_remove_source to have more control over a source deletion.
Motivation and Context
On a shutdown there is a few steps to make sure what resources get cleaned up.
First FE call osn::Source::Release.
Then destroyOBS_API release some objects.
And then destroyOBS_API checks for sources what was not yet removed and call them for release.
But there could be a race condition between releasing an source on prev step and checking for its existence on last. It could lead to a crash.
As a fix osn::Source::Release will use obs_source_remove and obs_source_removed to set object in removed state immediately mitigating a race condition.
This was not applied for a transition sources as they managed in a bit separate way. Release for them not expect them to be destroyed.
Also obs_set_output_source was moved to a begining of a sequence as sources can stay bind to output after an release.
How Has This Been Tested?
Run with additional logs to check cleanup of sources on a shutdown.
Types of changes
Bug fix (non-breaking change which fixes an issue)
Checklist:
[x] The code has been tested.
[x] All commit messages are properly formatted and commits squashed where appropriate.
[x] I have included updates to all appropriate documentation.
Description
Use obs_remove_source to have more control over a source deletion.
Motivation and Context
On a shutdown there is a few steps to make sure what resources get cleaned up. First FE call osn::Source::Release. Then destroyOBS_API release some objects. And then destroyOBS_API checks for sources what was not yet removed and call them for release. But there could be a race condition between releasing an source on prev step and checking for its existence on last. It could lead to a crash.
As a fix osn::Source::Release will use obs_source_remove and obs_source_removed to set object in removed state immediately mitigating a race condition.
This was not applied for a transition sources as they managed in a bit separate way. Release for them not expect them to be destroyed.
Also obs_set_output_source was moved to a begining of a sequence as sources can stay bind to output after an release.
How Has This Been Tested?
Run with additional logs to check cleanup of sources on a shutdown.
Types of changes
Checklist: