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.

gpui: Fix crash when starting Zed on macOS during texture creation (#36382)

Smit Barmase7dc4adbd4027
diff --git a/crates/gpui/src/platform/mac/metal_renderer.rs b/crates/gpui/src/platform/mac/metal_renderer.rs
index 629654014d5..a686d8c45bf 100644
--- a/crates/gpui/src/platform/mac/metal_renderer.rs
+++ b/crates/gpui/src/platform/mac/metal_renderer.rs
@@ -314,6 +314,15 @@ impl MetalRenderer {
}
fn update_path_intermediate_textures(&mut self, size: Size<DevicePixels>) {
+ // We are uncertain when this happens, but sometimes size can be 0 here. Most likely before
+ // the layout pass on window creation. Zero-sized texture creation causes SIGABRT.
+ // https://github.com/zed-industries/zed/issues/36229
+ if size.width.0 <= 0 || size.height.0 <= 0 {
+ self.path_intermediate_texture = None;
+ self.path_intermediate_msaa_texture = None;
+ return;
+ }
+
let texture_descriptor = metal::TextureDescriptor::new();
texture_descriptor.set_width(size.width.0 as u64);
texture_descriptor.set_height(size.height.0 as u64);