Sfoglia il codice sorgente

Added proper destructor for synchronized_callback

Paul-Louis Ageneau 5 anni fa
parent
commit
08931de03b
1 ha cambiato i file con 3 aggiunte e 0 eliminazioni
  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 {
 public:
+	synchronized_callback() = default;
+	~synchronized_callback() { *this = nullptr; }
+
 	synchronized_callback &operator=(std::function<void(P...)> func) {
 		std::lock_guard<std::recursive_mutex> lock(mutex);
 		callback = func;