From 030f82d34fdaba9f157b7c17866f700fd21b5026 Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Sat, 27 Jun 2020 13:59:01 +0200 Subject: [PATCH] Reset pointer on charholder to prevent multiple deletions. --- src/String/StringView.hpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/String/StringView.hpp b/src/String/StringView.hpp index 486dbde..7e33892 100644 --- a/src/String/StringView.hpp +++ b/src/String/StringView.hpp @@ -27,7 +27,11 @@ namespace ArbUt { : _value(new char[value.length() + 1]), _references(1) { strncpy(_value, value.data(), value.length() + 1); } - ~__ConstStringCharHolder() { delete[] _value; } + + ~__ConstStringCharHolder() noexcept { + delete[] _value; + _value = nullptr; + } inline void RemoveReference() noexcept { if (--_references <= 0) {