diff --git a/modules/juce_core/native/juce_ObjCHelpers_mac.h b/modules/juce_core/native/juce_ObjCHelpers_mac.h index 0c1450e8c3..7f2c9c5700 100644 --- a/modules/juce_core/native/juce_ObjCHelpers_mac.h +++ b/modules/juce_core/native/juce_ObjCHelpers_mac.h @@ -317,7 +317,7 @@ struct ObjCClass jassert (cls != nil); } - virtual ~ObjCClass() + ~ObjCClass() { auto kvoSubclassName = String ("NSKVONotifying_") + class_getName (cls); @@ -325,6 +325,16 @@ struct ObjCClass objc_disposeClassPair (cls); } + ObjCClass (ObjCClass&& other) noexcept + : cls (std::exchange (other.cls, {})) {} + + ObjCClass& operator= (ObjCClass&& other) noexcept + { + auto tmp = std::move (other); + std::swap (tmp.cls, cls); + return *this; + } + void registerClass() { if (cls != nil)