From 1b7de8b6b105b0c29d8377d4d2e6ffa98cb6783e Mon Sep 17 00:00:00 2001 From: Michael Fabian 'Xaymar' Dirks Date: Tue, 2 Apr 2019 19:11:26 +0200 Subject: [PATCH] util-event: Automatically clear event listeners when destructed --- source/util-event.hpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/source/util-event.hpp b/source/util-event.hpp index e3c85183..57293145 100644 --- a/source/util-event.hpp +++ b/source/util-event.hpp @@ -30,6 +30,13 @@ namespace util { std::function silence_cb; public /* functions */: + + // Destructor + inline ~event() + { + this->clear(); + } + // Add new listener. inline void add(std::function listener) {