diff --git a/wgpu-core/src/instance.rs b/wgpu-core/src/instance.rs index c8b32aef86..f2ffa74a75 100644 --- a/wgpu-core/src/instance.rs +++ b/wgpu-core/src/instance.rs @@ -590,11 +590,13 @@ impl Global { .gl .as_ref() .map(|inst| { + let raw_surface = inst.create_surface_from_canvas(canvas)?; Ok(HalSurface { - raw: Arc::new(inst.create_surface_from_canvas(canvas)?), + raw: Arc::new(raw_surface), }) }) - .transpose()?; + .transpose()? + .unwrap(); AnySurface::new(hal_surface) }, }; @@ -624,11 +626,13 @@ impl Global { .gl .as_ref() .map(|inst| { + let raw_surface = inst.create_surface_from_offscreen_canvas(canvas)?; Ok(HalSurface { - raw: Arc::new(inst.create_surface_from_offscreen_canvas(canvas)?), + raw: Arc::new(raw_surface), }) }) - .transpose()?; + .transpose()? + .unwrap(); AnySurface::new(hal_surface) }, };