From ef8b77c9a37db452e9bd85c42f5f5659f85ea5d6 Mon Sep 17 00:00:00 2001 From: Samuliak Date: Sat, 6 Apr 2024 17:35:12 +0200 Subject: [PATCH] metal: do not release not existing buffers --- src/video_core/renderer_metal/mtl_buffer_cache.mm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/video_core/renderer_metal/mtl_buffer_cache.mm b/src/video_core/renderer_metal/mtl_buffer_cache.mm index ff6daf3bf7..a3f78b28f1 100644 --- a/src/video_core/renderer_metal/mtl_buffer_cache.mm +++ b/src/video_core/renderer_metal/mtl_buffer_cache.mm @@ -25,7 +25,9 @@ BoundBuffer::BoundBuffer(MTLBuffer_t buffer_, size_t offset_, size_t size_) : buffer{[buffer_ retain]}, offset{offset_}, size{size_} {} BoundBuffer::~BoundBuffer() { - [buffer release]; + if (buffer) { + [buffer release]; + } } BufferView::BufferView(MTLBuffer_t buffer_, size_t offset_, size_t size_,