From 9ae155b8e26480fd78ff289fceec0cdf2d476463 Mon Sep 17 00:00:00 2001 From: Hojjat Date: Wed, 20 May 2026 00:25:37 -0600 Subject: [PATCH] fix: crash while resizing on x11 --- wgpu/src/window/compositor.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/wgpu/src/window/compositor.rs b/wgpu/src/window/compositor.rs index bbef994d..4033aea4 100644 --- a/wgpu/src/window/compositor.rs +++ b/wgpu/src/window/compositor.rs @@ -368,6 +368,13 @@ pub fn present( ) -> Result<(), compositor::SurfaceError> { match surface.get_current_texture() { Ok(frame) => { + if frame.suboptimal + || frame.texture.width() != viewport.physical_width() + || frame.texture.height() != viewport.physical_height() + { + return Err(compositor::SurfaceError::Outdated); + } + let view = &frame .texture .create_view(&wgpu::TextureViewDescriptor::default());