瀏覽代碼

Backends: Metal: Conditional check, amend 7602277 (#5122, #5123)

Co-authored-by: Wvader <[email protected]>
whale02 3 年之前
父節點
當前提交
2d76b09d2e
共有 1 個文件被更改,包括 5 次插入2 次删除
  1. 5 2
      backends/imgui_impl_metal.mm

+ 5 - 2
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<MTLCommandBuffer>)
     {
         dispatch_async(dispatch_get_main_queue(), ^{