Describe the bug
I've integrated Runestone into one of my apps, where it gets displayed in a SwiftUI view using UIHostingView
. I'm seeing some occasional crashes which seem to come from the OperationQueue
in TreeSitterInternalLanguageMode
.
I am not sure how to best address this. Any advice would be appreciated.
To Reproduce
No reliably steps to reproduce yet, as it's not deterministic.
Additional context
Sample stacktrace from an iPad Pro running iOS 15.5 (19F77), from the main thread:
Thread 0#0 (null) in objc_release ()
#1 (null) in -[NSOperationQueue dealloc] ()
#2 (null) in TreeSitterInternalLanguageMode.__deallocating_deinit ()
#3 (null) in _swift_release_dealloc ()
#4 (null) in bool swift::HeapObjectSideTableEntry::decrementStrong<(swift::PerformDeinit)1>(unsigned int) ()
#5 (null) in IndentController.__deallocating_deinit ()
#6 (null) in _swift_release_dealloc ()
#7 (null) in @objc TextInputView.__ivar_destroyer ()
#8 (null) in object_cxxDestructFromClass(objc_object*, objc_class*) ()
#9 (null) in objc_destructInstance ()
#10 (null) in _objc_rootDealloc ()
#11 (null) in -[UIResponder dealloc] ()
#12 (null) in -[UIView dealloc] ()
#13 (null) in @objc TextView.__ivar_destroyer ()
#14 (null) in object_cxxDestructFromClass(objc_object*, objc_class*) ()
#15 (null) in objc_destructInstance ()
#16 (null) in _objc_rootDealloc ()
#17 (null) in -[UIResponder dealloc] ()
#18 (null) in -[UIView dealloc] ()
#19 (null) in -[UIScrollView dealloc] ()
#20 (null) in @objc PlatformViewHost.__ivar_destroyer ()
#21 (null) in object_cxxDestructFromClass(objc_object*, objc_class*) ()
#22 (null) in objc_destructInstance ()
#23 (null) in _objc_rootDealloc ()
#24 (null) in -[UIResponder dealloc] ()
#25 (null) in -[UIView dealloc] ()
#26 (null) in (anonymous namespace)::destroyGenericBox(swift::HeapObject*) ()
#27 (null) in _swift_release_dealloc ()
#28 (null) in partial apply for thunk for @callee_guaranteed (@unowned UnsafePointer<A1>) -> (@unowned Attribute<A>, @error @owned Error) ()
#29 (null) in _swift_release_dealloc ()
#30 (null) in swift_arrayDestroy ()
#31 (null) in _ContiguousArrayStorage.__deallocating_deinit ()
#32 (null) in _swift_release_dealloc ()
#33 (null) in swift_arrayDestroy ()
#34 (null) in _ContiguousArrayStorage.__deallocating_deinit ()
#35 (null) in _swift_release_dealloc ()
#36 (null) in swift_arrayDestroy ()
#37 (null) in _ContiguousArrayStorage.__deallocating_deinit ()
#38 (null) in _swift_release_dealloc ()
#39 (null) in DisplayList.ViewUpdater.deinit ()
#40 (null) in DisplayList.ViewUpdater.__deallocating_deinit ()
#41 (null) in _swift_release_dealloc ()
#42 (null) in DisplayList.ViewRenderer.deinit ()
#43 (null) in DisplayList.ViewRenderer.__deallocating_deinit ()
#44 (null) in _swift_release_dealloc ()
#45 (null) in @objc _UIHostingView.__ivar_destroyer ()
#46 (null) in object_cxxDestructFromClass(objc_object*, objc_class*) ()
#47 (null) in objc_destructInstance ()
#48 (null) in _objc_rootDealloc ()
#49 (null) in -[UIResponder dealloc] ()
#50 (null) in -[UIView dealloc] ()
#51 (null) in _UIHostingView.__deallocating_deinit ()
#52 (null) in @objc _UIHostingView.__deallocating_deinit ()
#53 (null) in AutoreleasePoolPage::releaseUntil(objc_object**) ()
#54 (null) in objc_autoreleasePoolPop ()
#55 (null) in -[UIView dealloc] ()
#56 (null) in -[UITableViewCell .cxx_destruct] ()
#57 (null) in object_cxxDestructFromClass(objc_object*, objc_class*) ()
#58 (null) in objc_destructInstance ()
#59 (null) in _objc_rootDealloc ()
#60 (null) in -[UIResponder dealloc] ()
#61 (null) in -[UIView dealloc] ()
#62 (null) in -[UITableViewCell dealloc] ()
#63 (null) in __RELEASE_OBJECTS_IN_THE_ARRAY__ ()
#64 (null) in -[__NSArrayM dealloc] ()
#65 (null) in -[__NSOrderedSetM dealloc] ()
#66 (null) in cow_cleanup ()
#67 (null) in -[__NSDictionaryM dealloc] ()
#68 (null) in -[UITableView .cxx_destruct] ()
#69 (null) in object_cxxDestructFromClass(objc_object*, objc_class*) ()
#70 (null) in objc_destructInstance ()
#71 (null) in _objc_rootDealloc ()
#72 (null) in -[UIResponder dealloc] ()
#73 (null) in -[UIView dealloc] ()
#74 (null) in -[UIScrollView dealloc] ()
#75 (null) in -[UITableView dealloc] ()
#76 (null) in cow_cleanup ()
#77 (null) in -[__NSDictionaryM dealloc] ()
#78 (null) in -[UIViewController .cxx_destruct] ()
#79 (null) in object_cxxDestructFromClass(objc_object*, objc_class*) ()
#80 (null) in objc_destructInstance ()
#81 (null) in _objc_rootDealloc ()
#82 (null) in -[UIResponder dealloc] ()
#83 (null) in -[UIViewController dealloc] ()
#84 (null) in object_cxxDestructFromClass(objc_object*, objc_class*) ()
#85 (null) in objc_destructInstance ()
#86 (null) in _objc_rootDealloc ()
#87 (null) in cow_cleanup ()
#88 (null) in -[__NSDictionaryM dealloc] ()
#89 (null) in object_cxxDestructFromClass(objc_object*, objc_class*) ()
#90 (null) in objc_destructInstance ()
#91 (null) in _objc_rootDealloc ()
#92 (null) in object_cxxDestructFromClass(objc_object*, objc_class*) ()
#93 (null) in objc_destructInstance ()
#94 (null) in _objc_rootDealloc ()
#95 (null) in -[UIResponder dealloc] ()
#96 (null) in -[UIViewController dealloc] ()
#97 (null) in @objc PlatformViewHost.__ivar_destroyer ()
#98 (null) in object_cxxDestructFromClass(objc_object*, objc_class*) ()
#99 (null) in objc_destructInstance ()
#100 (null) in _objc_rootDealloc ()
#101 (null) in -[UIResponder dealloc] ()
#102 (null) in -[UIView dealloc] ()
#103 (null) in (anonymous namespace)::destroyGenericBox(swift::HeapObject*) ()
#104 (null) in _swift_release_dealloc ()
#105 (null) in partial apply for thunk for @callee_guaranteed (@unowned UnsafePointer<A1>) -> (@unowned Attribute<A>, @error @owned Error) ()
#106 (null) in _swift_release_dealloc ()
#107 (null) in swift_arrayDestroy ()
#108 (null) in _ContiguousArrayStorage.__deallocating_deinit ()
#109 (null) in _swift_release_dealloc ()
#110 (null) in DisplayList.ViewUpdater.deinit ()
#111 (null) in DisplayList.ViewUpdater.__deallocating_deinit ()
#112 (null) in _swift_release_dealloc ()
#113 (null) in DisplayList.ViewRenderer.deinit ()
#114 (null) in DisplayList.ViewRenderer.__deallocating_deinit ()
#115 (null) in _swift_release_dealloc ()
#116 (null) in @objc _UIHostingView.__ivar_destroyer ()
#117 (null) in object_cxxDestructFromClass(objc_object*, objc_class*) ()
#118 (null) in objc_destructInstance ()
#119 (null) in _objc_rootDealloc ()
#120 (null) in -[UIResponder dealloc] ()
#121 (null) in -[UIView dealloc] ()
#122 (null) in _UIHostingView.__deallocating_deinit ()
#123 (null) in @objc _UIHostingView.__deallocating_deinit ()
#124 (null) in AutoreleasePoolPage::releaseUntil(objc_object**) ()
#125 (null) in objc_autoreleasePoolPop ()
#126 (null) in _CFAutoreleasePoolPop ()
#127 (null) in __CFRunLoopPerCalloutARPEnd ()
#128 (null) in __CFRunLoopRun ()
#129 (null) in CFRunLoopRunSpecific ()
#130 (null) in GSEventRunModal ()
#131 (null) in -[UIApplication _run] ()
#132 (null) in UIApplicationMain ()
#133 0x00000001002271a8 in main at /Users/adrian/Development/maparoni/Maparoni/helpers/OSLog+Loggers.swift:18