Revert "Fix use-after-free when creating custom user messages"
This reverts commit 15450a6d0c
.
This commit is contained in:
parent
a761194917
commit
81ad870def
@ -312,12 +312,12 @@ bool UserMessages::EndMessage()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE
|
#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE
|
||||||
PbHandle localBuffer = std::move(m_FakeEngineBuffer);
|
|
||||||
if (m_CurFlags & USERMSG_BLOCKHOOKS)
|
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,
|
ENGINE_CALL(SendUserMessage)(static_cast<IRecipientFilter &>(m_CellRecFilter), m_CurId,
|
||||||
*priv.GetPrivateMessage());
|
*priv.GetPrivateMessage());
|
||||||
|
m_FakeEngineBuffer = nullptr;
|
||||||
} else {
|
} else {
|
||||||
OnMessageEnd_Pre();
|
OnMessageEnd_Pre();
|
||||||
|
|
||||||
@ -327,9 +327,10 @@ bool UserMessages::EndMessage()
|
|||||||
case MRES_HANDLED:
|
case MRES_HANDLED:
|
||||||
case MRES_OVERRIDE:
|
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,
|
engine->SendUserMessage(static_cast<IRecipientFilter &>(m_CellRecFilter), m_CurId,
|
||||||
*priv.GetPrivateMessage());
|
*priv.GetPrivateMessage());
|
||||||
|
m_FakeEngineBuffer = nullptr;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
//case MRES_SUPERCEDE:
|
//case MRES_SUPERCEDE:
|
||||||
|
@ -105,8 +105,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
PbHandle& operator =(PbHandle&& other) {
|
PbHandle& operator =(PbHandle&& other) {
|
||||||
if (other.msg_ != msg_)
|
maybe_free();
|
||||||
maybe_free();
|
|
||||||
msg_ = other.msg_;
|
msg_ = other.msg_;
|
||||||
ownership_ = other.ownership_;
|
ownership_ = other.ownership_;
|
||||||
locality_ = other.locality_;
|
locality_ = other.locality_;
|
||||||
|
Loading…
Reference in New Issue
Block a user