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_wgpu: Fix wgpu renderer teardown panic (#60160)

Philipp Schaffrath56009f39bb91
diff --git a/crates/gpui_wgpu/src/wgpu_renderer.rs b/crates/gpui_wgpu/src/wgpu_renderer.rs
index 08f30dc0090..587315debfa 100644
--- a/crates/gpui_wgpu/src/wgpu_renderer.rs
+++ b/crates/gpui_wgpu/src/wgpu_renderer.rs
@@ -962,7 +962,9 @@ impl WgpuRenderer {
self.surface_config.height = clamped_height.max(1);
let surface_config = self.surface_config.clone();
- let resources = self.resources_mut();
+ let Some(resources) = self.resources.as_mut() else {
+ return;
+ };
// Wait for any in-flight GPU work to complete before destroying textures
if let Err(e) = resources.device.poll(wgpu::PollType::Wait {
@@ -1035,7 +1037,9 @@ impl WgpuRenderer {
let surface_config = self.surface_config.clone();
let path_sample_count = self.rendering_params.path_sample_count;
let dual_source_blending = self.dual_source_blending;
- let resources = self.resources_mut();
+ let Some(resources) = self.resources.as_mut() else {
+ return;
+ };
resources
.surface
.configure(&resources.device, &surface_config);