flowkey / UIKit-cross-platform

Cross-platform Swift implementation of UIKit, mostly for Android
MIT License
597 stars 40 forks source link

SegFault on CGImage deallocation leads to app crashes #208

Closed cshg closed 5 years ago

cshg commented 6 years ago

Priority: High

Current behavior

When opening the player it crashes or freezes sometimes.

Some Devices where this occurred so far:

Log

Link to Bugsnag logs

Segmentation fault: Fatal signal from native code: 11 (Segmentation fault)
        at FreeImage(libSDL2.so:1163688)
        at UIKit.CGImage.__deallocating_deinit(UIKit/Sources/CGImage.swift:51)
        at function signature specialization <preserving fragile attribute, Arg[1] = Owned To Guaranteed> of Swift._introSort<A where A: Swift.MutableCollection, A: Swift.RandomAccessCollection, A.Element: Swift.Comparable>(inout A, subRange: Swift.Range<A.Index>) -> ()(libswiftCore.so:4405300)
        at function signature specialization <preserving fragile attribute, Arg[2] = Owned To Guaranteed> of function signature specialization <preserving fragile attribute, Arg[1] = Owned To Guaranteed> of Swift._insertionSort<A where A: Swift.BidirectionalCollection, A: Swift.MutableCollection>(inout A, subRange: Swift.Range<A.Index>, by: (A.Element, A.Element) throws -> Swift.Bool) throws -> ()(libswiftCore.so:4410220)
        at function signature specialization <preserving fragile attribute, Arg[1] = Owned To Guaranteed> of Swift._introSort<A where A: Swift.MutableCollection, A: Swift.RandomAccessCollection, A.Element: Swift.Comparable>(inout A, subRange: Swift.Range<A.Index>) -> ()(libswiftCore.so:4399768)
        at UIKit.CALayer.deinit(libUIKit.so:343836)
        at UIKit.CALayer.__deallocating_deinit(UIKit/Sources/CALayer.swift:11)
        at function signature specialization <preserving fragile attribute, Arg[1] = Owned To Guaranteed> of Swift._introSort<A where A: Swift.MutableCollection, A: Swift.RandomAccessCollection, A.Element: Swift.Comparable>(inout A, subRange: Swift.Range<A.Index>) -> ()(libswiftCore.so:4405300)
        at function signature specialization <preserving fragile attribute, Arg[2] = Owned To Guaranteed> of function signature specialization <preserving fragile attribute, Arg[1] = Owned To Guaranteed> of Swift._insertionSort<A where A: Swift.BidirectionalCollection, A: Swift.MutableCollection>(inout A, subRange: Swift.Range<A.Index>, by: (A.Element, A.Element) throws -> Swift.Bool) throws -> ()(libswiftCore.so:4410220)
        at function signature specialization <preserving fragile attribute, Arg[1] = Owned To Guaranteed> of Swift._introSort<A where A: Swift.MutableCollection, A: Swift.RandomAccessCollection, A.Element: Swift.Comparable>(inout A, subRange: Swift.Range<A.Index>) -> ()(libswiftCore.so:4399768)
        at UIKit.UILabel.deinit(libUIKit.so:662968)
        at UIKit.UILabel.__deallocating_deinit(libUIKit.so:668572)
        at function signature specialization <preserving fragile attribute, Arg[1] = Owned To Guaranteed> of Swift._introSort<A where A: Swift.MutableCollection, A: Swift.RandomAccessCollection, A.Element: Swift.Comparable>(inout A, subRange: Swift.Range<A.Index>) -> ()(libswiftCore.so:4405300)
        at function signature specialization <preserving fragile attribute, Arg[2] = Owned To Guaranteed> of function signature specialization <preserving fragile attribute, Arg[1] = Owned To Guaranteed> of Swift._insertionSort<A where A: Swift.BidirectionalCollection, A: Swift.MutableCollection>(inout A, subRange: Swift.Range<A.Index>, by: (A.Element, A.Element) throws -> Swift.Bool) throws -> ()(libswiftCore.so:4409896)
        at function signature specialization <preserving fragile attribute, Arg[2] = Owned To Guaranteed> of function signature specialization <preserving fragile attribute, Arg[1] = Owned To Guaranteed> of Swift._insertionSort<A where A: Swift.BidirectionalCollection, A: Swift.MutableCollection>(inout A, subRange: Swift.Range<A.Index>, by: (A.Element, A.Element) throws -> Swift.Bool) throws -> ()(libswiftCore.so:4409464)
        at function signature specialization <preserving fragile attribute, Arg[1] = Owned To Guaranteed> of Swift._introSort<A where A: Swift.MutableCollection, A: Swift.RandomAccessCollection, A.Element: Swift.Comparable>(inout A, subRange: Swift.Range<A.Index>) -> ()(libswiftCore.so:4405300)
        at swift::Demangle::demangleOldSymbolAsNode(llvm::StringRef, swift::Demangle::NodeFactory&)(libswiftCore.so:5207956)
        at function signature specialization <preserving fragile attribute, Arg[1] = Owned To Guaranteed> of Swift._introSort<A where A: Swift.MutableCollection, A: Swift.RandomAccessCollection, A.Element: Swift.Comparable>(inout A, subRange: Swift.Range<A.Index>) -> ()(libswiftCore.so:4399768)
        at FlowkeyPlayer.SongMetaDataView.__deallocating_deinit(libAndroidPlayer.so:595208)
        at function signature specialization <preserving fragile attribute, Arg[1] = Owned To Guaranteed> of Swift._introSort<A where A: Swift.MutableCollection, A: Swift.RandomAccessCollection, A.Element: Swift.Comparable>(inout A, subRange: Swift.Range<A.Index>) -> ()(libswiftCore.so:4405300)
        at function signature specialization <preserving fragile attribute, Arg[2] = Owned To Guaranteed> of function signature specialization <preserving fragile attribute, Arg[1] = Owned To Guaranteed> of Swift._insertionSort<A where A: Swift.BidirectionalCollection, A: Swift.MutableCollection>(inout A, subRange: Swift.Range<A.Index>, by: (A.Element, A.Element) throws -> Swift.Bool) throws -> ()(libswiftCore.so:4409896)
        at function signature specialization <preserving fragile attribute, Arg[2] = Owned To Guaranteed> of function signature specialization <preserving fragile attribute, Arg[1] = Owned To Guaranteed> of Swift._insertionSort<A where A: Swift.BidirectionalCollection, A: Swift.MutableCollection>(inout A, subRange: Swift.Range<A.Index>, by: (A.Element, A.Element) throws -> Swift.Bool) throws -> ()(libswiftCore.so:4409464)
        at function signature specialization <preserving fragile attribute, Arg[1] = Owned To Guaranteed> of Swift._introSort<A where A: Swift.MutableCollection, A: Swift.RandomAccessCollection, A.Element: Swift.Comparable>(inout A, subRange: Swift.Range<A.Index>) -> ()(libswiftCore.so:4405300)
        at swift::Demangle::demangleOldSymbolAsNode(llvm::StringRef, swift::Demangle::NodeFactory&)(libswiftCore.so:5207956)
        at function signature specialization <preserving fragile attribute, Arg[1] = Owned To Guaranteed> of Swift._introSort<A where A: Swift.MutableCollection, A: Swift.RandomAccessCollection, A.Element: Swift.Comparable>(inout A, subRange: Swift.Range<A.Index>) -> ()(libswiftCore.so:4399768)
        at FlowkeyPlayer.LoadingView.__deallocating_deinit(libAndroidPlayer.so:484068)
        at function signature specialization <preserving fragile attribute, Arg[1] = Owned To Guaranteed> of Swift._introSort<A where A: Swift.MutableCollection, A: Swift.RandomAccessCollection, A.Element: Swift.Comparable>(inout A, subRange: Swift.Range<A.Index>) -> ()(libswiftCore.so:4405300)
        at function signature specialization <preserving fragile attribute, Arg[2] = Owned To Guaranteed> of function signature specialization <preserving fragile attribute, Arg[1] = Owned To Guaranteed> of Swift._insertionSort<A where A: Swift.BidirectionalCollection, A: Swift.MutableCollection>(inout A, subRange: Swift.Range<A.Index>, by: (A.Element, A.Element) throws -> Swift.Bool) throws -> ()(libswiftCore.so:4409896)
        at function signature specialization <preserving fragile attribute, Arg[2] = Owned To Guaranteed> of function signature specialization <preserving fragile attribute, Arg[1] = Owned To Guaranteed> of Swift._insertionSort<A where A: Swift.BidirectionalCollection, A: Swift.MutableCollection>(inout A, subRange: Swift.Range<A.Index>, by: (A.Element, A.Element) throws -> Swift.Bool) throws -> ()(libswiftCore.so:4409464)
        at function signature specialization <preserving fragile attribute, Arg[1] = Owned To Guaranteed> of Swift._introSort<A where A: Swift.MutableCollection, A: Swift.RandomAccessCollection, A.Element: Swift.Comparable>(inout A, subRange: Swift.Range<A.Index>) -> ()(libswiftCore.so:4399768)
        at PlayerTestAppSDL.PlayerLoadingController.__deallocating_deinit(Sources/PlayerTestAppSDL/PlayerLoadingController.swift:36)
        at function signature specialization <preserving fragile attribute, Arg[1] = Owned To Guaranteed> of Swift._introSort<A where A: Swift.MutableCollection, A: Swift.RandomAccessCollection, A.Element: Swift.Comparable>(inout A, subRange: Swift.Range<A.Index>) -> ()(libswiftCore.so:4405300)

User description

Sometimes when I try to open a song, the app either crashes, or the loading never ends. In the latter situation, I am forced to reload the song. Sometimes, when I'm playing a song, the video will pause out of nowhere, and it won't unpause for a moment. The video may also skip a few seconds ahead of me and pause, in that case, it will only unpause when I correctly play all the notes up to the moment where it paused.

intercom conversation link

Environment

Reported most recently and frequently here: