From a67f06f82d71ca90bd961e391770e0f168d112d7 Mon Sep 17 00:00:00 2001 From: falkTX Date: Wed, 6 Aug 2025 17:24:00 +0200 Subject: [PATCH] Add ScopedPointer::reset() method Signed-off-by: falkTX --- distrho/extra/ScopedPointer.hpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/distrho/extra/ScopedPointer.hpp b/distrho/extra/ScopedPointer.hpp index 6349199c..5e04fb13 100644 --- a/distrho/extra/ScopedPointer.hpp +++ b/distrho/extra/ScopedPointer.hpp @@ -172,6 +172,11 @@ public: /** Lets you access methods and properties of the object that this ScopedPointer refers to. */ ObjectType* operator->() const noexcept { return object; } + //============================================================================== + /** Removes the current object from this ScopedPointer and deletes it. + */ + void reset() noexcept { ObjectType* const o = object; object = nullptr; delete o; } + //============================================================================== /** Removes the current object from this ScopedPointer without deleting it. This will return the current object, and set the ScopedPointer to a null pointer.