Revert "Fix use-after-free when creating custom user messages"

This reverts commit 15450a6d0c.
This commit is contained in:
David Anderson 2022-07-31 11:16:50 -07:00
parent a761194917
commit 81ad870def
2 changed files with 5 additions and 5 deletions

View File

@ -312,12 +312,12 @@ bool UserMessages::EndMessage()
}
#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE
PbHandle localBuffer = std::move(m_FakeEngineBuffer);
if (m_CurFlags & USERMSG_BLOCKHOOKS)
{
PbHandle priv = localBuffer.ToPrivate(m_CurId);
PbHandle priv = m_FakeEngineBuffer.ToPrivate(m_CurId);
ENGINE_CALL(SendUserMessage)(static_cast<IRecipientFilter &>(m_CellRecFilter), m_CurId,
*priv.GetPrivateMessage());
m_FakeEngineBuffer = nullptr;
} else {
OnMessageEnd_Pre();
@ -327,9 +327,10 @@ bool UserMessages::EndMessage()
case MRES_HANDLED:
case MRES_OVERRIDE:
{
PbHandle priv = localBuffer.ToPrivate(m_CurId);
PbHandle priv = m_FakeEngineBuffer.ToPrivate(m_CurId);
engine->SendUserMessage(static_cast<IRecipientFilter &>(m_CellRecFilter), m_CurId,
*priv.GetPrivateMessage());
m_FakeEngineBuffer = nullptr;
break;
}
//case MRES_SUPERCEDE:

View File

@ -105,8 +105,7 @@ public:
}
PbHandle& operator =(PbHandle&& other) {
if (other.msg_ != msg_)
maybe_free();
maybe_free();
msg_ = other.msg_;
ownership_ = other.ownership_;
locality_ = other.locality_;