From a08ea2a255f4e3965827bc5bc0a7e283855ff890 Mon Sep 17 00:00:00 2001 From: Jinlei Li Date: Sat, 20 Aug 2022 22:14:57 +0800 Subject: [PATCH] metal: add the missing `msg_send![view, retain]` call within `from_view` (#2976) * metal: add the missing `msg_send![view, retain]` call within `from_view` * Update CHANGELOG --- CHANGELOG.md | 3 +++ wgpu-hal/src/metal/surface.rs | 1 + 2 files changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 95d4fde680..e28391366c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -68,6 +68,9 @@ the same every time it is rendered, we now warn if it is missing. - Fix compilation errors when using wgpu-core in isolation while targetting `wasm32-unknown-unknown` by @Seamooo in [#2922](https://github.com/gfx-rs/wgpu/pull/2922) - Fixed opening of RenderDoc library by @abuffseagull in [#2930](https://github.com/gfx-rs/wgpu/pull/2930) +#### Metal +- Add the missing `msg_send![view, retain]` call within `from_view` by @jinleili in [#2976](https://github.com/gfx-rs/wgpu/pull/2976) + ### Changes #### General diff --git a/wgpu-hal/src/metal/surface.rs b/wgpu-hal/src/metal/surface.rs index be10bf7bb6..cd6a3ce935 100644 --- a/wgpu-hal/src/metal/surface.rs +++ b/wgpu-hal/src/metal/surface.rs @@ -86,6 +86,7 @@ impl super::Surface { let render_layer = mem::transmute::<_, &mtl::MetalLayerRef>(Self::get_metal_layer(view, delegate)) .to_owned(); + let _: *mut c_void = msg_send![view, retain]; Self::new(NonNull::new(view), render_layer) }