You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tested in TF2 windows and linux with 2.2.0-detours7, i couldn't get to test whenever non-detour version would still crash but im pretty sure it does as i haven't seen any related changes between it.
I'm getting a lot of these crashes, but this one caught my eyes on how it happened, which it seems like it crashed here.
I have a plugin with several hook removal callback, and another plugin that automatically unloads plugin on map end. From what i can see it crashes when dhook tries to call a removal callback while plugin is being unloaded.
Smallest reproduce i can make:
Load below plugin named disabled/42test.smx
Join server
Change map
This will unload plugin and dhook attempting to call OnHookRemoved, leading to a crash.
#include<sdktools>
#include<dhooks>Handle g_hHookGetMaxHealth;
public voidOnPluginStart()
{
GameData hGameData = newGameData("sdkhooks.games");
if (hGameData == null)
SetFailState("Could not find sdkhooks.games gamedata");
int iOffset = hGameData.GetOffset("GetMaxHealth");
g_hHookGetMaxHealth = DHookCreate(iOffset, HookType_Entity, ReturnType_Int, ThisPointer_CBaseEntity);
if (g_hHookGetMaxHealth == null)
LogMessage("Failed to create hook: CTFPlayer::GetMaxHealth");
delete hGameData;
//Lateloadfor (int iClient = 1; iClient <= MaxClients; iClient++)
if (IsClientInGame(iClient))
OnClientPutInServer(iClient);
}
public voidOnMapEnd()
{
ServerCommand("sm plugins unload disabled/42test");
}
public voidOnClientPutInServer(int iClient)
{
DHookEntity(g_hHookGetMaxHealth, true, iClient, OnHookRemoved, GetMaxHealth);
}
public voidOnHookRemoved(int iHookId)
{
}
public MRESReturn GetMaxHealth(int iClient, Handle hReturn)
{
return MRES_Ignored;
}
The text was updated successfully, but these errors were encountered:
When a plugin which registered an entity vtable hook with a remove callback is unloaded OnMapEnd, dhooks still tried to call the removal callback on the next frame after the map ended and all entities were destroyed.
Remove the plugin's hooks from the removal list when a plugin is unloaded. The hooks are free'd anyways.
Drifter321#3
The previous fix in ac44af9 did not remove the hook itself instead of only not calling the removal callback. So yes, the removal callback wouldn't be called anymore, but the hook wouldn't be removed causing the normal hook callback to fire after the plugin unloaded.
Drifter321#3
Tested in TF2 windows and linux with
2.2.0-detours7
, i couldn't get to test whenever non-detour version would still crash but im pretty sure it does as i haven't seen any related changes between it.I'm getting a lot of these crashes, but this one caught my eyes on how it happened, which it seems like it crashed here.
I have a plugin with several hook removal callback, and another plugin that automatically unloads plugin on map end. From what i can see it crashes when dhook tries to call a removal callback while plugin is being unloaded.
Smallest reproduce i can make:
disabled/42test.smx
This will unload plugin and dhook attempting to call
OnHookRemoved
, leading to a crash.The text was updated successfully, but these errors were encountered: