From abad186530e1b8a04c97ea6efcd11652c9bf376c Mon Sep 17 00:00:00 2001 From: a/ Date: Sun, 27 Jun 2021 20:18:12 +0900 Subject: [PATCH] SAGA2: Fix timer delete on removeAllTimers --- engines/saga2/objects.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/engines/saga2/objects.cpp b/engines/saga2/objects.cpp index 34677bc1809..4e142278739 100644 --- a/engines/saga2/objects.cpp +++ b/engines/saga2/objects.cpp @@ -1844,9 +1844,10 @@ void GameObject::removeAllTimers(void) { // Get this object's timer list if ((timerList = fetchTimerList(this)) != nullptr) { - for (Common::List::iterator it = timerList->_timers.begin(); it != timerList->_timers.end(); ++it) { - timerList->_timers.erase(it); - } + for (Common::List::iterator it = timerList->_timers.begin(); it != timerList->_timers.end(); ++it) + delete *it; + + timerList->_timers.clear(); delete timerList; }