mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-08-29 02:03:03 +08:00
06291c7201
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.