Skip to content

appsrc/appsink: Make setting/replacing callbacks thread-safe

Previously we would simply use them without any locking at all, while using the object lock for setting them. Nothing prevented new callbacks to be set in the meantime, potentially calling a callback with already freed user_data.

To prevent this move the callbacks into a reference counted struct and use the appsrc/appsink mutex to protect access to it, which is used in all functions calling the callbacks already anyway.

Fixes #729 (closed)


CC @tpm

Merge request reports