-
-
Notifications
You must be signed in to change notification settings - Fork 406
Hotkeys stop working after spamming the Cancel button #1231
Description
Priority
Medium
Area
- Data
- Source
- Docker
- Other
What happened?
The hotkey system breaks when users repeatedly click the Cancel button during the simulation (Ctrl+G). This is due to an unbalanced counter in the enableHotkeys function that becomes out of sync with multiple quick calls.
Root Cause
The problem originates from the function that uses a counter system where enableHotkeys(false) increments and enableHotkeys(true) decrements disableHotkeysCount. When users spam the Cancel button, multiple enableHotkeys(true) calls occur without corresponding enableHotkeys(false) calls, causing the counter to go negative.
Steps to Reproduce
- Use Ctrl+G
- When the window appears, quickly click the Cancel button multiple times
- Hotkeys (especially F1-F12) stop working until relogging the character
Necessary Corrections
The fixes resolve the root cause by preventing the disableHotkeysCount counter from becoming unbalanced and ensuring boundKeyPressCombos doesn't get corrupted during Cancel button spam.
1. Fix enableHotkeys Function
Modify hotkeys_manager.lua:798-804 :
local hotkeyDisableWidget = nil
function enableHotkeys(value)
if value then
if hotkeyDisableWidget then
hotkeyDisableWidget:destroy()
hotkeyDisableWidget = nil
end
else
if not hotkeyDisableWidget then
hotkeyDisableWidget = g_ui.createWidget('UIWidget')
hotkeyDisableWidget:setId('hotkeyDisableWidget')
hotkeyDisableWidget:hide()
end
end
end
function areHotkeysDisabled()
return hotkeyDisableWidget ~= nil
end
What OS are you seeing the problem on?
Windows
Code of Conduct
- I agree to follow this project's Code of Conduct