I keep experiencing this crash in 5 of my extensions. I tried to dig deeper into this problem and found out that the crash only happens if an extension with either OnPlayerRunCmd or OnPostThink hooks for all players is running. For this crash to happen it is enough to have an empty hook, like this:
PHP Code:
CPlayer::CPlayer(CBaseEntity* entity)
: Inherited(entity)
{
SH_ADD_MANUALHOOK(CPlayer_PostThink, GetBaseEntity(), SH_MEMBER(this, &CPlayer::OnPostThink), true);
}
CPlayer::~CPlayer(void)
{
SH_REMOVE_MANUALHOOK(CPlayer_PostThink, GetBaseEntity(), SH_MEMBER(this, &CPlayer::OnPostThink), true);
}
void CPlayer::OnPostThink()
{
RETURN_META(MRES_IGNORED);
}
If I comment lines SH_ADD_MANUALHOOK and SH_REMOVE_MANUALHOOK the server stops crashing. Can it be a bug in sourcemod? If yes, then is there a way to debug it?
UPD
It turns out that Weapon_CanUse hook can also couse this crash. tripmines.ext.2.csgo.so + 0x96ebc - int __cdecl __SourceHook_MFHCls_CPlayer_Weapon_CanUse::Fu nc(int a1, int a2)
PHP Code:
CPlayer::CPlayer(CBaseEntity* entity)
: Inherited(entity)
{
SH_ADD_MANUALHOOK(CPlayer_Weapon_CanUse, GetBaseEntity(), SH_MEMBER(this, &CPlayer::OnWeapon_CanUse), false);
}
CPlayer::~CPlayer(void)
{
SH_REMOVE_MANUALHOOK(CPlayer_Weapon_CanUse, GetBaseEntity(), SH_MEMBER(this, &CPlayer::OnWeapon_CanUse), false);
}
bool CPlayer::OnWeapon_CanUse(CBaseEntity* pWeapon)
{
RETURN_META_VALUE(MRES_IGNORED, true);
}