From 77e67c19fe863d15575781feaf0a6a3f2a701d02 Mon Sep 17 00:00:00 2001 From: Marshall Bowers Date: Mon, 2 Oct 2023 16:10:41 -0400 Subject: [PATCH] Fix deadlock when obtaining the font ID --- crates/gpui3/src/text_system.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/gpui3/src/text_system.rs b/crates/gpui3/src/text_system.rs index 544392cc1022f04016a80f6139503d521c5b84d9..c7e4d763162b6a8e884386ee02f3cca470eab7db 100644 --- a/crates/gpui3/src/text_system.rs +++ b/crates/gpui3/src/text_system.rs @@ -50,7 +50,9 @@ impl TextSystem { } pub fn font_id(&self, font: &Font) -> Result { - if let Some(font_id) = self.font_ids_by_font.read().get(font).copied() { + let font_id = self.font_ids_by_font.read().get(font).copied(); + + if let Some(font_id) = font_id { Ok(font_id) } else { let font_id = self.platform_text_system.font_id(font)?;