diff --git a/sourcehook/sourcehook.cpp b/sourcehook/sourcehook.cpp index 07e4034..d7f8e7f 100644 --- a/sourcehook/sourcehook.cpp +++ b/sourcehook/sourcehook.cpp @@ -782,7 +782,7 @@ namespace SourceHook // But: we have to return false in the post phase of pre recalls (ie. a pre hook made a recall). if (m_HLIStack.front().recall == HookLoopInfo::Recall_Pre && - static_cast(m_HLIStack.front().pCurIface)->m_PostHooks.RQFlagGet()) + static_cast(m_HLIStack.front().pCurIface)->m_PreHooks.RelFlagGet()) { return false; } @@ -1020,6 +1020,8 @@ namespace SourceHook } void CSourceHookImpl::CHookList::ReleaseIter(IIter *pIter) { + m_RelFlag = true; + CIter *pIter2 = static_cast(pIter); // Unlink from m_UsedIters @@ -1029,7 +1031,7 @@ namespace SourceHook if (pIter2->m_pPrev) pIter2->m_pPrev->m_pNext = pIter2->m_pNext; if (pIter2 == m_UsedIters) - m_UsedIters = NULL; + m_UsedIters = m_UsedIters->m_pNext; // Link to m_FreeIters diff --git a/sourcehook/sourcehook_impl.h b/sourcehook/sourcehook_impl.h index 25dce4a..2c30900 100644 --- a/sourcehook/sourcehook_impl.h +++ b/sourcehook/sourcehook_impl.h @@ -277,6 +277,7 @@ namespace SourceHook // For recalls bool m_Recall; bool m_RQFlag; + bool m_RelFlag; void SetRecallState(); // Sets the list into a state where the next returned // iterator (from GetIter) will be a copy of the last @@ -284,8 +285,9 @@ namespace SourceHook // The hook resets this state automatically on: // GetIter, ReleaseIter - void RQFlagReset() { m_RQFlag = false; } + void RQFlagReset() { m_RQFlag = false; m_RelFlag = false; } bool RQFlagGet() { return m_RQFlag; } + bool RelFlagGet() { return m_RelFlag; } CHookList(); CHookList(const CHookList &other); virtual ~CHookList();