Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
libobs: Fix race when to-be-destroyed encoder group finishes stopping
Fixes a crash when the following steps occur: - Encoder group created and then started with encoders, only the group owning encoder refs - Encoder group destroy called: group has `destroy_on_stop` set without actual destroy - Outputs holding encoders from stopping are stopped - `remove_connection()` function destroys encoder group, releasing encoders and causing the currently processed encoder to be destroyed early - parent scopes try to access destroyed encoder pointer and crash This change moves some logic around to improve the release/destruct order of `obs_encoder_stop()` to fix the race above. Note: Cases of encoder errors will not destruct the group if it has `destroy_on_stop` set, as the encoder is also not destroyed if it also is set to destroy on stop. This part of the code should be revisited at a later date and fixed up to prevent memory leaks.
- Loading branch information