Skip to content

Hotkeys stop working after spamming the Cancel button #1231

@AureusP

Description

@AureusP

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

  1. Use Ctrl+G
  2. When the window appears, quickly click the Cancel button multiple times
  3. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Priority: MediumThis issue may be impactful and needs some attention.Status: Pending TestThis PR or Issue requires more testingType: BugInconsistencies or issues which will cause an issue or problem for users or implementors.duplicateThis issue or pull request already exists

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions