SDWebImage / SDWebImageSwiftUI

SwiftUI Image loading and Animation framework powered by SDWebImage
https://sdwebimage.github.io/SDWebImageSwiftUI
MIT License
2.1k stars 216 forks source link

SDWebImageSwiftUI player crash with unknown reasons on iOS 15.0+ #276

Closed jaymeen-unadkat-differenz closed 6 months ago

jaymeen-unadkat-differenz commented 9 months ago

Issue Info

Info Value
Platform Name iOS
Platform Version 15.0+
SDWebImage Version 5.12.14
Integration Method cocoapods
Xcode Version Xcode 14
Repro rate sometimes

Issue Description and Steps

I'm currently facing an issue with SDWebImageSwiftUI and the version is 2.0.2. The application is getting crashed with unknown reason and i can detect that using firebase crashlytics

The title for the issue is $s17SDWebImageSwiftUI0B6PlayerCfD in firebase crashlytics.

I'm not able to reproduce the issue in the debug but it is occurring in live, So I'm sharing the screenshots below

https://github.com/SDWebImage/SDWebImageSwiftUI/assets/147508947/b4e4e7ee-6924-4265-8c12-6f4d0ca88d96 https://github.com/SDWebImage/SDWebImageSwiftUI/assets/147508947/04650e03-f033-456a-a1c4-5b9c43813687

jaymeen-unadkat-differenz commented 9 months ago

Screen Shot 2023-10-10 at 5 11 42 PM

jaymeen-unadkat-differenz commented 9 months ago

Screen Shot 2023-10-10 at 5 11 16 PM

dreampiggy commented 9 months ago

Seems a danger pointer issue (object was dealloced in thread1, but trigger another function call and Combine publisher in thread 2)

I guess this is because of current code design. The player can decode on background queue, but always dispatch in main queue for new frames. These two queue need a thread-safe lock solution.

However, the Objc-part of SDAnimatedImagePlayer does not consider this case, maybe also need the SDWebImage upgrade

dreampiggy commented 6 months ago

Solved by v2.2.6