From 35a24e12eb60301a9067bef9369b6ce8917412ae Mon Sep 17 00:00:00 2001 From: Sandu Liviu Catalin Date: Tue, 3 Jul 2018 22:31:13 +0300 Subject: [PATCH] Fix bug in signal implementation which did not update the number of remaining slots after removing some. --- source/Signal.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/Signal.cpp b/source/Signal.cpp index 25b71cfd..37e85dbc 100644 --- a/source/Signal.cpp +++ b/source/Signal.cpp @@ -876,7 +876,7 @@ SQInteger Signal::Eliminate(SignalWrapper & w) // Backup the current number of used slots const SizeType count = m_Used; // Forward the call to the actual function - RemoveIf(MatchSlot< Slot >(w.mSlot.mThisHash, w.mSlot.mFuncHash), + m_Used -= RemoveIf(MatchSlot< Slot >(w.mSlot.mThisHash, w.mSlot.mFuncHash), m_Slots, m_Slots + m_Used, m_Scope); // Push the number of removed slots sq_pushinteger(w.mVM, static_cast< SQInteger >(count - m_Used)); @@ -899,7 +899,7 @@ SQInteger Signal::EliminateThis(SignalWrapper & w) // Backup the current number of used slots const SizeType count = m_Used; // Forward the call to the actual function - RemoveIf(MatchThis< Slot >(w.mSlot.mThisHash), m_Slots, m_Slots + m_Used, m_Scope); + m_Used -= RemoveIf(MatchThis< Slot >(w.mSlot.mThisHash), m_Slots, m_Slots + m_Used, m_Scope); // Push the number of removed slots sq_pushinteger(w.mVM, static_cast< SQInteger >(count - m_Used)); } @@ -921,7 +921,7 @@ SQInteger Signal::EliminateFunc(SignalWrapper & w) // Backup the current number of used slots const SizeType count = m_Used; // Forward the call to the actual function - RemoveIf(MatchFunc< Slot >(w.mSlot.mFuncHash), m_Slots, m_Slots + m_Used, m_Scope); + m_Used -= RemoveIf(MatchFunc< Slot >(w.mSlot.mFuncHash), m_Slots, m_Slots + m_Used, m_Scope); // Push the number of removed slots sq_pushinteger(w.mVM, static_cast< SQInteger >(count - m_Used)); }