From 0c11c350b2aa740520f7e5f83ea0d320799a204c Mon Sep 17 00:00:00 2001 From: nosoop Date: Wed, 10 Jul 2019 02:03:48 -0700 Subject: [PATCH] Prevent NativeVote menu from nuking handler Increments the refcount of the private forward. This prevents a crash on Debian 10 and doesn't seem like well-defined behavior. --- addons/sourcemod/scripting/nativevotes.sp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/sourcemod/scripting/nativevotes.sp b/addons/sourcemod/scripting/nativevotes.sp index 10df5a1..c419096 100644 --- a/addons/sourcemod/scripting/nativevotes.sp +++ b/addons/sourcemod/scripting/nativevotes.sp @@ -821,7 +821,7 @@ Action DoAction(NativeVote vote, MenuAction action, int param1, int param2, Acti { Action res = def_res; - Handle handler = Data_GetHandler(vote); + Handle handler = CloneHandle(Data_GetHandler(vote)); #if defined LOG LogMessage("Calling Menu forward for vote: %d, handler: %d, action: %d, param1: %d, param2: %d", vote, handler, action, param1, param2); #endif @@ -831,6 +831,7 @@ Action DoAction(NativeVote vote, MenuAction action, int param1, int param2, Acti Call_PushCell(param1); Call_PushCell(param2); Call_Finish(res); + delete handler; return res; }