Fix crash when deleting a Menu handle during callbacks (#2536)
* Root menu Handles during callbacks * Delete unused AutoHandleRooter struct * Fix crash when a vote is cancelled from its start callback * menus: root vote menu during start callback --------- Co-authored-by: Nicholas Hastings <[email protected]>
This commit is contained in:
co-authored by
Nicholas Hastings
parent
8c0aa36bbd
commit
61dea382c9
@@ -97,6 +97,9 @@ void BaseMenuStyle::_CancelClientMenu(int client, MenuCancelReason reason, bool
|
||||
RemoveClientFromWatch(client);
|
||||
}
|
||||
|
||||
Handle_t hndl = menu ? menu->GetHandle() : BAD_HANDLE;
|
||||
AutoHandleRooter ahr(hndl);
|
||||
|
||||
/* Fire callbacks */
|
||||
mh->OnMenuCancel(menu, client, reason);
|
||||
|
||||
@@ -576,6 +579,8 @@ bool BaseMenuStyle::RedoClientMenu(int client, ItemOrder order)
|
||||
CBaseMenuPlayer *player = GetMenuPlayer(client);
|
||||
menu_states_t &states = player->states;
|
||||
|
||||
AutoHandleRooter ahr(states.menu ? states.menu->GetHandle() : BAD_HANDLE);
|
||||
|
||||
player->bAutoIgnore = true;
|
||||
IMenuPanel *display = g_Menus.RenderMenu(client, states, order);
|
||||
if (!display)
|
||||
|
||||
Reference in New Issue
Block a user