From 2d76b09d2e054831ddb353e3fb620f47b8fa07aa Mon Sep 17 00:00:00 2001 From: whale02 <34067397+whale02@users.noreply.github.com> Date: Mon, 28 Mar 2022 09:58:27 +0100 Subject: [PATCH] Backends: Metal: Conditional check, amend 7602277 (#5122, #5123) Co-authored-by: Wvader <34067397+wvader@users.noreply.github.com> --- backends/imgui_impl_metal.mm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/backends/imgui_impl_metal.mm b/backends/imgui_impl_metal.mm index d2eb4651..6b3680cd 100644 --- a/backends/imgui_impl_metal.mm +++ b/backends/imgui_impl_metal.mm @@ -582,8 +582,11 @@ void ImGui_ImplMetal_DestroyDeviceObjects() vertexBufferOffset += (size_t)cmd_list->VtxBuffer.Size * sizeof(ImDrawVert); indexBufferOffset += (size_t)cmd_list->IdxBuffer.Size * sizeof(ImDrawIdx); } - - id weakSelf = self; +#if __has_feature(objc_arc) + __weak id weakSelf = self; +#else + __unsafe_unretained id weakSelf = self; +#endif [commandBuffer addCompletedHandler:^(id) { dispatch_async(dispatch_get_main_queue(), ^{