Fix potential crash during gifv playback

I don't know how this is possible, but it evidently is
This commit is contained in:
Shadowfacts 2024-11-25 20:54:35 -05:00
parent 351efe4b58
commit a5066140fd
2 changed files with 4 additions and 4 deletions

View File

@ -208,9 +208,9 @@ private class PlayerView: UIView {
playerLayer.player = player playerLayer.player = player
playerLayer.videoGravity = .resizeAspect playerLayer.videoGravity = .resizeAspect
presentationSizeObservation = item.observe(\.presentationSize, changeHandler: { [unowned self] _, _ in presentationSizeObservation = item.observe(\.presentationSize, changeHandler: { [weak self] _, _ in
MainActor.assumeIsolated { MainActor.assumeIsolated {
self.invalidateIntrinsicContentSize() self?.invalidateIntrinsicContentSize()
} }
}) })
} }

View File

@ -60,9 +60,9 @@ class GifvController {
} }
private func updatePresentationSizeObservation() { private func updatePresentationSizeObservation() {
presentationSizeObservation = item.observe(\.presentationSize, changeHandler: { [unowned self] item, _ in presentationSizeObservation = item.observe(\.presentationSize, changeHandler: { [weak self] item, _ in
DispatchQueue.main.async { DispatchQueue.main.async {
self.presentationSizeSubject.send(item.presentationSize) self?.presentationSizeSubject.send(item.presentationSize)
} }
}) })
} }