Fixed crash when activating command listeners on EP1 while inside a command callback (bug 4072, r=pred).
This commit is contained in:
parent
2698ff1a04
commit
3030ab8664
@ -284,6 +284,23 @@ class GenericCommandHooker
|
|||||||
Patch cgc;
|
Patch cgc;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
static void DelayedActivation(void *inparam)
|
||||||
|
{
|
||||||
|
GenericCommandHooker *cdtrs = reinterpret_cast<GenericCommandHooker*>(inparam);
|
||||||
|
/* Safe to re-enter because the frame queue is lock+swapped. */
|
||||||
|
if ((!cdtrs->ces.applied || !cdtrs->cgc.applied) &&
|
||||||
|
g_HL2.PeekCommandStack() != NULL)
|
||||||
|
{
|
||||||
|
g_SourceMod.AddFrameAction(GenericCommandHooker::DelayedActivation, cdtrs);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!cdtrs->ces.applied)
|
||||||
|
cdtrs->ApplyPatch(&cdtrs->ces);
|
||||||
|
if (!cdtrs->cgc.applied)
|
||||||
|
cdtrs->ApplyPatch(&cdtrs->cgc);
|
||||||
|
}
|
||||||
|
|
||||||
bool Enable()
|
bool Enable()
|
||||||
{
|
{
|
||||||
const char *platform = NULL;
|
const char *platform = NULL;
|
||||||
@ -321,6 +338,12 @@ public:
|
|||||||
if (!PrepPatch("CGameClient::ExecuteString", "CGC", platform, &cgc))
|
if (!PrepPatch("CGameClient::ExecuteString", "CGC", platform, &cgc))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (g_HL2.PeekCommandStack() != NULL)
|
||||||
|
{
|
||||||
|
g_SourceMod.AddFrameAction(GenericCommandHooker::DelayedActivation, this);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
ApplyPatch(&ces);
|
ApplyPatch(&ces);
|
||||||
ApplyPatch(&cgc);
|
ApplyPatch(&cgc);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user