From b0ed08d4b5993adcbfe734f34e80af32cfc34ec6 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Sat, 31 Mar 2012 09:36:38 +0200 Subject: [PATCH] Make sure to remove dead weak delegates from events. --- base/event.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/base/event.h b/base/event.h index de6e6cbbe..36e07e5fa 100644 --- a/base/event.h +++ b/base/event.h @@ -42,7 +42,10 @@ public: prev = i; i++; - (*prev)(args); + int result = (*prev)(args); + + if (result == -1) + m_Delegates.erase(prev); } } };