Repository navigation
Show desktop reader code blocks as plain text when highlighting overflows the stack - #1632
Conversation
|
@DanielSouzaBertoldi can you take a look if you can repro? |
|
Sentry stack traces for the crash this PR fixes. Both issues are one event each, 38 s apart, from the same user, almost certainly the same article opened twice. The JVM keeps only the top 1024 frames of a JAVA-N1 — https://mgp-dev-studio.sentry.io/issues/JAVA-N1 (event 48297051f388441baa24ebe7d9eb4cd4, 2026-11-06T08:33:09Z)release: com.prof18.feedflow@1.19.0 · runtime: JetBrains s.r.o. 25.0.4.1 · thread: AWT-EventQueue-0 · handled: no · mechanism: UncaughtExceptionHandler · level: fatal JAVA-N2 — https://mgp-dev-studio.sentry.io/issues/JAVA-N2 (event 38b3eee6b5354dcaa4fa028ce6d17ae1, 2026-11-06T08:33:47Z)release: com.prof18.feedflow@1.19.0 · runtime: JetBrains s.r.o. 25.0.4.1 · thread: AWT-EventQueue-0 · handled: no · mechanism: UncaughtExceptionHandler · level: fatal Same crash reproduced by the new
|
Jewel's SimpleCodeHighlighter matches string literals and comments with backtracking regexes that recurse once per character, so an article code block with one very long token overflowed the stack and the error, rethrown on the UI thread, crashed the desktop app (Sentry JAVA-N1/JAVA-N2, 1.19.0). The desktop reader now wraps the highlighter and shows such a block as plain text, keeping highlighting everywhere else. Covered by a unit test that reproduces the overflow on Jewel's highlighter and a Compose test that renders a 200k-character JSON literal in every desktop theme, which crashed before the fix.