-
Notifications
You must be signed in to change notification settings - Fork 19
Crash: Simultaneous accesses to 0x… but modification requires exclusive access. #7
Comments
Great writeup as always, @regexident! I have half a mind to start an Etsy shop that sells framed prints of your bug reports 😍 The good news is that I'm pretty sure what the underlying cause is. This old-school documentation from Apple has a good writeup:
Although this was last updated in 2014, I believe the diagnosis is still correct. As for the prescribed treatment... it may work, but it's far from optimal. I must admit that when I was first writing this library, I had a vague memory of HTML → Where do we go from here? Like I said, I'm not a fan of the workaround prescribed in Apple's documentation. I think the best long-term solution will involve finding or creating a new library (preferably, using Markup) for doing the HTML conversion. |
Ugh, I didn't mean to close this. 🙄
😆 Having been on the receiving end of quite a few horribly impudent and lazy issues myself I just try my best to be a good open source citizen. 😅
Probably the best solution, yeah. Or maybe just skip HTML entirely and go straight from Markdown to Either way, lemme know if I can help you here in any way. Doing things ourselves would also give us more control over how the output is formatted. (also cough #6 cough 😏) |
To clarify, I'm proposing that, for each
Will do! This seems "fun" enough that I may well have a sketch of this within the next couple days. |
I have the same problem.
It works if I put them into the global queue. ✅
|
A nice, I also debugged this as part of Nio. It doesn't seem to be a threading issue (both accesses are in one stack), but really a concurrent Swift access thing due to some weird WebKit/SwiftUI nesting. (I think it may happen because the thing is nested within a Swift constructor, but not quite sure) I think NSXMLParser is based on libxml2 and supports HTML (or is that just NSXMLDocument?). If so, one could probably use that to parse some basic HTML instead. Oh, and I forgot: This isn't actually a bug in CommonMarkAttributedString, but in |
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: &documentAttributes
withdocumentAttributes: 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.git
SPM package.Change the contents of
ContentView.body
to …Start the app in iOS simulator and watch it crash.
The text was updated successfully, but these errors were encountered: