mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-07-26 07:06:07 -04:00
(This also modifies the UI) The purpose of deferring destruction of sources is to ensure that: 1.) Hard locks from enumeration cannot occur with source destruction. For example, if the browser source is destroyed while in the graphics thread, the browser thread would wait for the graphics thread, but the graphics thread would still be waiting for the browser thread, causing a hard lock. 2.) When destroys occur during source enumeration, that the integrity of the context's next pointer in the linked list can no longer be compromised 3.) Source releases are fully asynchronous rather than having the risk of stalling the calling thread 4.) We can wait for source destruction when switching scene collections or when shutting down rather than hoping for threads to be finished with sources. This introduces a new requirement when cleaning up scene/source data: the obs_wait_for_destroy_queue() function. It is highly recommended that this function be called after cleaning up sources. It will return true if at least one or more sources were destroyed. Otherwise it will return false. Forks are highly advised to call this function manually on source cleanup -- preferably in a loop, in conjunction with processing outstanding OBS signals and UI events.
266 KiB
266 KiB