Skip to content

winegstreamer: Fix memory/resource leaks in media sources.

Conor McCarthy requested to merge cmccarthy/wine:media_source_ref into master

Streams hold a reference to the source, but this reference should not be taken until Start() is called because freeing the media source depends on release in Shutdown() of the stream's reference to the source. We could create the streams in media_source_create() and take source refs for them in Start(), but that's potentially confusing and fragile.

Streams can persist after the media source is destroyed. In that case, they cannot access the source object and it should be released and set to null. Windows behaviour is to release references to the source in Shutdown(). If we don't do this and a buggy app were to leak a stream object, the media source object would also leak and wg_parser_destroy() would not be called.

Edited by Conor McCarthy

Merge request reports

Loading