From 771f2b3fe068a4de522b20678e458c73b0e759dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 28 Apr 2026 22:17:56 +0200 Subject: [PATCH] Avoid creating zero-size fonts (seems to be because of an init order problem during app switching) --- Common/Render/Text/draw_text_cocoa.mm | 4 ++++ Common/UI/View.cpp | 1 + 2 files changed, 5 insertions(+) diff --git a/Common/Render/Text/draw_text_cocoa.mm b/Common/Render/Text/draw_text_cocoa.mm index a98084112d..449ac404d1 100644 --- a/Common/Render/Text/draw_text_cocoa.mm +++ b/Common/Render/Text/draw_text_cocoa.mm @@ -138,6 +138,10 @@ TextDrawerCocoa::~TextDrawerCocoa() { // TODO: Share with other backends. void TextDrawerCocoa::SetOrCreateFont(const FontStyle &style) { + if (style.sizePts <= 0) { + return; + } + auto iter = fontMap_.find(style); if (iter != fontMap_.end()) { fontStyle_ = style; diff --git a/Common/UI/View.cpp b/Common/UI/View.cpp index 489d03868c..f052661c7c 100644 --- a/Common/UI/View.cpp +++ b/Common/UI/View.cpp @@ -1089,6 +1089,7 @@ const FontStyle *GetTextStyle(const UIContext &dc, TextSize size) { default: break; } + _dbg_assert_(style->sizePts > 0); return style; }