From 8854a77417dce07071b98e84760b2a897ade94c5 Mon Sep 17 00:00:00 2001 From: Azumgi <4zumgi@gmail.com> Date: Thu, 24 Jan 2019 23:18:14 +0300 Subject: [PATCH] [Custom View] Ensure cursor stack safety on reload --- vmf/scripts/mods/vmf/modules/gui/custom_views.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/vmf/scripts/mods/vmf/modules/gui/custom_views.lua b/vmf/scripts/mods/vmf/modules/gui/custom_views.lua index 0b1c943..e504c10 100644 --- a/vmf/scripts/mods/vmf/modules/gui/custom_views.lua +++ b/vmf/scripts/mods/vmf/modules/gui/custom_views.lua @@ -113,9 +113,13 @@ end local function remove_injected_views(on_reload) -- These elements should be removed only on_reload, because, otherwise, they will be deleted automatically. if on_reload then - -- If some custom view is active, close it. + -- If some custom view is active, safely close it. if _views_data[_ingame_ui.current_view] then + -- Hack to ensure cursor stack safety. + ShowCursorStack.stack_depth = ShowCursorStack.stack_depth + 1 _ingame_ui:handle_transition("exit_menu") + ShowCursorStack.stack_depth = 1 + ShowCursorStack.pop() end for view_name, view_data in pairs(_views_data) do