Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Fix deadlock when obtaining the font ID

Marshall Bowers77e67c19fe86
diff --git a/crates/gpui3/src/text_system.rs b/crates/gpui3/src/text_system.rs
index 544392cc102..c7e4d763162 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<FontId> {
- 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)?;