From 051bfb60208656a2cebc76b5a0c3c63da3de9fc8 Mon Sep 17 00:00:00 2001 From: Dennis Brakhane Date: Wed, 26 Nov 2025 08:21:12 +0100 Subject: [PATCH] handle self-assign (#1331) --- WickedEngine/wiAllocator.h | 1 + WickedEngine/wiFunction.h | 1 + 2 files changed, 2 insertions(+) diff --git a/WickedEngine/wiAllocator.h b/WickedEngine/wiAllocator.h index 8090094a6..852619f57 100644 --- a/WickedEngine/wiAllocator.h +++ b/WickedEngine/wiAllocator.h @@ -546,6 +546,7 @@ namespace wi::allocator } Allocation& operator=(const Allocation& other) { + if (&other == this) return *this; Reset(); allocator = other.allocator; internal_state = other.internal_state; diff --git a/WickedEngine/wiFunction.h b/WickedEngine/wiFunction.h index f32fc695c..314107a00 100644 --- a/WickedEngine/wiFunction.h +++ b/WickedEngine/wiFunction.h @@ -86,6 +86,7 @@ namespace wi function& operator=(const function& other) { + if (&other == this) return *this; destroy(); if (other.ptr) {