diff --git a/libobs/obs.hpp b/libobs/obs.hpp index 3e3351aa3..6bc43ed0c 100644 --- a/libobs/obs.hpp +++ b/libobs/obs.hpp @@ -77,6 +77,8 @@ template class OBSObj { public: inline OBSObj() : obj(nullptr) {} inline OBSObj(T obj_) : obj(obj_) {} + inline OBSObj(const OBSObj&) = delete; + inline OBSObj(OBSObj &&other) : obj(other.obj) { other.obj = nullptr; } inline ~OBSObj() {destroy(obj);} @@ -87,6 +89,15 @@ public: obj = obj_; return *this; } + inline OBSObj &operator=(const OBSObj&) = delete; + inline OBSObj &operator=(OBSObj &&other) + { + if (obj) + destroy(obj); + obj = other.obj; + other.obj = nullptr; + return *this; + } inline operator T() const {return obj;}