Comcast / mamba

Mamba is a Swift iOS, tvOS and macOS framework to parse, validate and write HTTP Live Streaming (HLS) data.
Apache License 2.0
178 stars 39 forks source link

`HLSParser` should not delete itself. #20

Closed dcoufal closed 5 years ago

dcoufal commented 6 years ago

Let's say we are asynchronously parsing a HLS playlist.

The client creates a HLSParser.

The client starts a parse with a callback.

The client does not retain a reference to the HLSParser while parsing happens.

Expected Behavior

The client should be called back.

Observed Behavior

The client is not called back.

Why? There is a weak ref between the HLSParseWorker and the HLSParser. As soon as the work starts, no one has a strong ref to HLSParser and it's deleted (along with the callback closure ref!).

I think the fix should be to have a temp strong link between the HLSParseWorker and the HLSParser which should be broken when the parse is done (to avoid a circular ref). There might be other fixes as well.

Observed on device(s):

Observed on OS Version(s):