You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 17, 2021. It is now read-only.
… in a SwiftUI app when trying to convert the following markdown string …
"E = mc<sup>2</sup>"
… to an NSAttributedString (while doing the same with "E = mc^2" works just fine).
Userland stack-trace:
#00x00007fff2c80f85a in ViewRendererHost.render(interval:updateDisplayList:)()
#10x00007fff2c452e2e in closure #1 in _UIHostingView.requestImmediateUpdate()()
#20x00007fff2c44d959 in thunk for @escaping @callee_guaranteed()->()()
#30x0000000106895f11 in _dispatch_call_block_and_release ()
#40x0000000106896e8e in _dispatch_client_callout ()
#50x00000001068a4d97 in _dispatch_main_queue_callback_4CF ()
#60x00007fff23da0909 in __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ ()
#70x00007fff23d9b459 in __CFRunLoopRun ()
#80x00007fff23d9a944 in CFRunLoopRunSpecific()
#90x00007fff481778be in -[NSHTMLReader _loadUsingWebKit]()
#100x00007fff4817882b in -[NSHTMLReader attributedString]()
#110x00007fff48101ef0 in _NSReadAttributedStringFromURLOrData ()
#120x00007fff480ff915 in -[NSAttributedString(NSAttributedStringUIFoundationAdditions) initWithData:options:documentAttributes:error:]()
#130x000000010655812e in @nonobjc NSMutableAttributedString.init(data:options:documentAttributes:)()
#140x0000000106557f5a in NSMutableAttributedString.__allocating_init(data:options:documentAttributes:)()
#150x00000001065578e1 in NSAttributedString.init(html:attributes:) at ~/Library/Developer/Xcode/DerivedData/Crasher-alelyvwrvwarxvekibncuyjaqpcs/SourcePackages/checkouts/CommonMarkAttributedString/Sources/CommonMarkAttributedString/NSAttributedString+Extensions.swift:35
#160x000000010654fe0a in Node.attributedString(attributes:attachments:) at ~/Library/Developer/Xcode/DerivedData/Crasher-alelyvwrvwarxvekibncuyjaqpcs/SourcePackages/checkouts/CommonMarkAttributedString/Sources/CommonMarkAttributedString/CommonMark+Extensions.swift:42
#170x000000010655206a in @objc Node.attributedString(attributes:attachments:)()
#180x0000000106550b86 in closure #2 in Node.attributedString(attributes:attachments:) at ~/Library/Developer/Xcode/DerivedData/Crasher-alelyvwrvwarxvekibncuyjaqpcs/SourcePackages/checkouts/CommonMarkAttributedString/Sources/CommonMarkAttributedString/CommonMark+Extensions.swift:38
#190x0000000106551ed4 in partial apply for closure #2 in Node.attributedString(attributes:attachments:)()
#200x0000000106550cc0 in thunk for @callee_guaranteed (@guaranteed Node & Block)->(@owned NSAttributedString,@error@owned Error)()
#210x0000000106551ef4 in partial apply for thunk for @callee_guaranteed (@guaranteed Node & Block)->(@owned NSAttributedString,@error@owned Error)()
#220x00007fff510663c5 in Collection.map<A>(_:)()
#230x000000010654f4d8 in Node.attributedString(attributes:attachments:) at ~/Library/Developer/Xcode/DerivedData/Crasher-alelyvwrvwarxvekibncuyjaqpcs/SourcePackages/checkouts/CommonMarkAttributedString/Sources/CommonMarkAttributedString/CommonMark+Extensions.swift:38
#240x000000010655206a in @objc Node.attributedString(attributes:attachments:)()
#250x000000010655713b in NSAttributedString.init(commonmark:attributes:attachments:) at ~/Library/Developer/Xcode/DerivedData/Crasher-alelyvwrvwarxvekibncuyjaqpcs/SourcePackages/checkouts/CommonMarkAttributedString/Sources/CommonMarkAttributedString/NSAttributedString+Extensions.swift:22
#260x000000010654d941 in ContentView.body.getter at ~/Downloads/Crasher/Crasher/ContentView.swift:15
#270x000000010654dbf9 in protocol witness for View.body.getter in conformance ContentView ()
#280x00007fff2c403bc2 in ViewBody.apply(_:)()
#290x00007fff2c406520 in protocol witness for static UntypedAttribute._update(_:graph:attribute:) in conformance ViewBody<A>()
#300x00007fff2fc78309 in partial apply ()
#310x00007fff2fc60d3d in AG::Graph::UpdateStack::update()()
#320x00007fff2fc6124b in AG::Graph::update_attribute(unsigned int, bool)()
#330x00007fff2fc65d53 in AG::Subgraph::update(unsigned int)()
#340x00007fff2c5359e0 in ViewGraph.runTransaction(in:)()
#350x00007fff2c535db7 in closure #1 in ViewGraph.updateOutputs(at:)()
#360x00007fff2c535a9d in ViewGraph.updateOutputs(at:)()
#370x00007fff2c81a7db in closure #1 in closure #1 in ViewRendererHost.render(interval:updateDisplayList:)()
#380x00007fff2c819c33 in closure #1 in ViewRendererHost.render(interval:updateDisplayList:)()
#390x00007fff2c80f785 in ViewRendererHost.render(interval:updateDisplayList:)()
#400x00007fff2c96f9e2 in _UIHostingView.layoutSubviews()()
#410x00007fff2c96fa05 in @objc _UIHostingView.layoutSubviews()()
#420x00007fff49193678 in -[UIView(CALayerDelegate) layoutSublayersOfLayer:]()
#430x00007fff2b4c6398 in -[CALayer layoutSublayers]()
#440x00007fff2b4cc523 in CA::Layer::layout_if_needed(CA::Transaction*)()
#450x00007fff2b4d7bba in CA::Layer::layout_and_display_if_needed(CA::Transaction*)()
#460x00007fff2b420c04 in CA::Context::commit_transaction(CA::Transaction*, double)()
#470x00007fff2b4545ef in CA::Transaction::commit()()
#480x00007fff48ca3747 in __34-[UIApplication _firstCommitBlock]_block_invoke_2()
#490x00007fff23da0b5c in __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ ()
#500x00007fff23da0253 in __CFRunLoopDoBlocks ()
#510x00007fff23d9b043 in __CFRunLoopRun ()
#520x00007fff23d9a944 in CFRunLoopRunSpecific()
#530x00007fff38ba6c1a in GSEventRunModal ()
#540x00007fff48c8b9ec in UIApplicationMain ()
#550x000000010654c5bb in main at ~/Downloads/Crasher/Crasher/AppDelegate.swift:12
#560x00007fff51a231fd in start ()
#570x00007fff51a231fd in start ()
Enqueued from com.apple.main-thread (Thread 1) Queue : com.apple.main-thread (serial)
#00x000000010689ad46 in dispatch_async()
#10x00007fff514a12e0 in OS_dispatch_queue.async(group:qos:flags:execute:)()
#20x00007fff2c452d23 in _UIHostingView.requestImmediateUpdate()()
#30x00007fff2c52fe97 in ViewGraph.transform.setter()
#40x00007fff2c451eac in _UIHostingView.updateTransform()()
#50x00007fff2c96f8d3 in @objc _UIHostingView._geometryChanges(_:forAncestor:)()
#60x00007fff49170089 in -[UIView _notifyGeometryObserversWithChangeInfo:]()
#70x00007fff4918cc50 in -[UIView(Internal) _addSubview:positioned:relativeTo:]()
#80x00007fff49138cab in -[UIDropShadowView setContentView:]()
#90x00007fff4850223d in -[_UISheetPresentationController presentationTransitionWillBegin]()
#100x00007fff484f3b5c in __71-[UIPresentationController _initViewHierarchyForPresentationSuperview:]_block_invoke ()
#110x00007fff484f13b3 in __56-[UIPresentationController runTransitionForCurrentState]_block_invoke.465()
#120x00007fff484f7569 in +[UIPresentationController _scheduleTransition:]()
#130x00007fff484f0f26 in -[UIPresentationController runTransitionForCurrentState]()
#140x00007fff484ee058 in -[UIPresentationController _presentWithAnimationController:interactionController:target:didEndSelector:]()
#150x00007fff48cc4452 in -[UIWindow addRootViewControllerViewIfPossible]()
#160x00007fff48cc3986 in -[UIWindow _updateLayerOrderingAndSetLayerHidden:actionBlock:]()
#170x00007fff48cc4a11 in -[UIWindow _setHidden:forced:]()
#180x00007fff48cd7e4d in -[UIWindow _mainQueue_makeKeyAndVisible]()
#190x000000010654d12b in SceneDelegate.scene(_:willConnectTo:options:) at ~/Downloads/Crasher/Crasher/SceneDelegate.swift:30
#200x000000010654d306 in @objc SceneDelegate.scene(_:willConnectTo:options:)()
#210x00007fff481e7cfb in +[UIScene _sceneForFBSScene:create:withSession:connectionOptions:]()
#220x00007fff48c87d2d in -[UIApplication _connectUISceneFromFBSScene:transitionContext:]()
#230x00007fff48c88064 in -[UIApplication workspace:didCreateScene:withTransitionContext:completion:]()
#240x00007fff487da8dc in -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:]()
#250x00007fff36cacd2e in -[FBSSceneImpl _callOutQueue_agent_didCreateWithTransitionContext:completion:]()
#260x00007fff36cd2dc1 in __86-[FBSWorkspaceScenesClient sceneID:createWithParameters:transitionContext:completion:]_block_invoke.154()
#270x00007fff36cb7757 in -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:]()
#280x00007fff36cd2a52 in __86-[FBSWorkspaceScenesClient sceneID:createWithParameters:transitionContext:completion:]_block_invoke ()
#290x0000000106896e8e in _dispatch_client_callout ()
#300x0000000106899da2 in _dispatch_block_invoke_direct ()
#310x00007fff36cf86e9 in __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ ()
#320x00007fff36cf83d7 in -[FBSSerialQueue _queue_performNextIfPossible]()
#330x00007fff36cf88e6 in -[FBSSerialQueue _performNextFromRunLoopSource]()
#340x00007fff23da0d31 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ ()
#350x00007fff23da0c5c in __CFRunLoopDoSource0()
#360x00007fff23da048c in __CFRunLoopDoSources0()
#370x00007fff23d9b02e in __CFRunLoopRun ()
#380x00007fff23d9a944 in CFRunLoopRunSpecific()
#390x00007fff38ba6c1a in GSEventRunModal ()
#400x00007fff48c8b9ec in UIApplicationMain ()
#410x000000010654c5bb in main at …/AppDelegate.swift:12
#420x00007fff51a231fd in start ()
What's apparently not causing the issue
I tried isolating/reproducing the issue in a unit test in a fork of CommonMarkAttributedString:
func testCrash()throws{letcommonmark=#""" E = mc<sup>2</sup> """##if canImport(UIKit)let _ =tryNSAttributedString(commonmark: commonmark)#elseif canImport(AppKit)let _ =tryNSAttributedString(commonmark: commonmark)#endif}func testCrash2()throws{lethtml=#""" <p>E = mc<!-- raw HTML omitted -->2<!-- raw HTML omitted --></p>\n """##if canImport(UIKit)let _ =tryNSAttributedString(html: html, attributes:[:])#elseif canImport(AppKit)let _ =tryNSAttributedString(html: html, attributes:[:])#endif}
But there things worked just fine. No crash. 😕
So next I tried replacing documentAttributes: &documentAttributes with documentAttributes: nil, since it is actually not used afterwards, and changed Nio's dependency to that fork, hoping it might solve the crasher. It didn't.
I'm getting a crash of …
… at this line …
… in a SwiftUI app when trying to convert the following markdown string …
… to an
NSAttributedString(while doing the same with"E = mc^2"works just fine).Userland stack-trace:
What's apparently not causing the issue
I tried isolating/reproducing the issue in a unit test in a fork of CommonMarkAttributedString:
But there things worked just fine. No crash. 😕
So next I tried replacing
documentAttributes: &documentAttributeswithdocumentAttributes: nil, since it is actually not used afterwards, and changed Nio's dependency to that fork, hoping it might solve the crasher. It didn't.How to reproduce
Create new single-view SwiftUI iOS app.
Add
https://github.com/mattt/CommonMarkAttributedString.gitSPM package.Change the contents of
ContentView.bodyto …Start the app in iOS simulator and watch it crash.