1
0
Эх сурвалжийг харах

Add missing copy/move operations for OBSSignal

Palana 11 жил өмнө
parent
commit
572401fd80
1 өөрчлөгдсөн 31 нэмэгдсэн , 0 устгасан
  1. 31 0
      libobs/obs.hpp

+ 31 - 0
libobs/obs.hpp

@@ -150,4 +150,35 @@ public:
 		param    = param_;
 		param    = param_;
 		signal_handler_connect(handler, signal, callback, param);
 		signal_handler_connect(handler, signal, callback, param);
 	}
 	}
+
+	OBSSignal(const OBSSignal&) = delete;
+	OBSSignal(OBSSignal &&other)
+		: handler (other.handler),
+		  signal  (other.signal),
+		  callback(other.callback),
+		  param   (other.param)
+	{
+		other.handler  = nullptr;
+		other.signal   = nullptr;
+		other.callback = nullptr;
+		other.param    = nullptr;
+	}
+
+	OBSSignal &operator=(const OBSSignal &) = delete;
+	OBSSignal &operator=(OBSSignal &&other)
+	{
+		Disconnect();
+
+		handler  = other.handler;
+		signal   = other.signal;
+		callback = other.callback;
+		param    = other.param;
+
+		other.handler  = nullptr;
+		other.signal   = nullptr;
+		other.callback = nullptr;
+		other.param    = nullptr;
+
+		return *this;
+	}
 };
 };