<del>Strikethrough HTML</del> leads to crash
kiliankoe opened this issue · 2 comments
Crashing in
nio/Nio/Shared Views/MarkdownText.swift
Lines 41 to 44 in f9b7be8
or to be more exact in https://github.com/mattt/CommonMarkAttributedString/blob/578419f521d16fd5fb6e757e7f5a6a4748fc0c38/Sources/CommonMarkAttributedString/NSAttributedString%2BExtensions.swift#L35
I don't think this is due to the strikethrough, it also happens w/ other input. It is always useful to look at what the crash is ;-):
Thread 1: Simultaneous accesses to 0x107200e10, but modification requires exclusive access
And the concurrent access started inLayoutComputer.EngineDelegate.sizeThatsFits
(presumably the SwiftUI layout).
It seems to be a weird interaction between WebKit (which is used for HTML parsing in NSAttributedString and seems to spin up a funky nested runloop?) and SwiftUI.
Actually it is probably "more complex HTML" which is piped through WebKit (maybe a "
or <!--
also triggers this. I tried to replicate it in a test case, which doesn't raise. Because the SwiftUI is missing.
The case we are currently seeing is a message which contains "<name> changed"
. CommonMarkAttributedString tries to pipe this through NSAttributedString(...html) which produces the issue.
Which I suppose brings us full circle why we even parse the stuff as Markdown ;-) This <name>
is verbatim content.