SRGSSR / srgletterbox-apple

The official SRG SSR media playback experience
https://srgssr.github.io/marketing/letterbox/
MIT License
14 stars 7 forks source link

Letterbox view leak #271

Closed defagos closed 2 years ago

defagos commented 2 years ago

If a Letterbox view is assigned to a controller which is retained somewhere else, it never can be properly deallocated. The controller is somehow retaining the view.

Issue type

Incorrect behavior

Environment information

Reproducibility

Always reproducible

Code sample

Two code samples:

  1. SwiftUI embedding example provided by @arpa-srf who initially reported the issue.
  2. A UIKit-only example I wrote to confirm this intuition.

If the controller and the view belong to the same object (e.g. a view controller) then no issue arises.

Steps to reproduce

  1. Run a sample project above.
  2. Verify with Instruments that Letterbox views are never deallocated when they are removed.
defagos commented 2 years ago

This was an unnoticed retain cycle which I fixed on feature/letterbox-view-leak-fix.