Skip to content

Guard PIN-code backspace focus - #11709

Draft
BenJule wants to merge 1 commit into
bambulab:masterfrom
BenJule:fix/pin-code-backspace-bounds
Draft

Guard PIN-code backspace focus#11709
BenJule wants to merge 1 commit into
bambulab:masterfrom
BenJule:fix/pin-code-backspace-bounds

Conversation

@BenJule

@BenJule BenJule commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Summary

Prevent the PIN-code dialog from focusing before the first input field when Backspace is pressed.

Root cause

PingCodeBindDialog::on_key_backspace() accepted idx == 0 and unconditionally focused m_text_input_single_code[idx - 1] from a deferred CallAfter callback.

Pressing Backspace in the first PIN field could therefore access the input array with index -1, causing undefined behavior.

Change

Only move focus to the preceding PIN field when the current index is greater than zero. The confirm button is still disabled for Backspace in every valid field.

Validation

  • verified index zero cannot reach the idx - 1 access
  • verified later fields retain the existing previous-field focus behavior
  • verified Backspace still disables the confirm button
  • git diff --check
  • targeted BindDialog.cpp syntax check when a matching compile database entry is available
  • one GPG-signed commit

No local full build was performed. Full application validation remains delegated to Jenkins.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant