浏览代码

Added proper destructor for synchronized_callback

Paul-Louis Ageneau 5 年之前
父节点
当前提交
08931de03b
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      include/rtc/include.hpp

+ 3 - 0
include/rtc/include.hpp

@@ -54,6 +54,9 @@ template <class... Ts> overloaded(Ts...)->overloaded<Ts...>;
 
 
 template <typename... P> class synchronized_callback {
 template <typename... P> class synchronized_callback {
 public:
 public:
+	synchronized_callback() = default;
+	~synchronized_callback() { *this = nullptr; }
+
 	synchronized_callback &operator=(std::function<void(P...)> func) {
 	synchronized_callback &operator=(std::function<void(P...)> func) {
 		std::lock_guard<std::recursive_mutex> lock(mutex);
 		std::lock_guard<std::recursive_mutex> lock(mutex);
 		callback = func;
 		callback = func;