Skip to content

Clear m_attemptingLock when a lock's autosave triggers a reload - #13733

Open
underclockeddev wants to merge 1 commit into
keepassxreboot:developfrom
underclockeddev:fix/lock-attempting-flag
Open

underclockeddev wants to merge 1 commit into
keepassxreboot:developfrom
underclockeddev:fix/lock-attempting-flag

Conversation

@underclockeddev

Copy link
Copy Markdown

Fixes #13732

DatabaseWidget::lock() sets m_attemptingLock, then autosaves a modified database. When that save fails and a reload has begun (the file changed on disk: "Database file has unmerged changes"), it returned early without clearing m_attemptingLock. Every later lock() then returned at the m_attemptingLock check, so the database could not be locked again until KeePassXC was restarted. Every other early return after m_attemptingLock = true already clears it; this one now does too.

The investigation and patch were done with Claude Code (Claude Opus 5.5) and reviewed by me before submitting.

Screenshots

N/A

Testing strategy

  • Headless end to end repro (private X server, D-Bus session and ssh-agent, throwaway database): https://gist.github.com/underclockeddev/39d33d927bd6cf9ed87b18434e2d6320. On develop every later lock is refused (8 of 8 runs). With this change each later lock asks the reload question again instead (3 of 3), and the script's control without an external change locks on both.
  • Full ctest suite (non-GUI) passes: 46/46.

Type of change

  • ✅ Bug fix (non-breaking change that fixes an issue)

DatabaseWidget::lock() returned early when its autosave failed and a reload
began, without clearing m_attemptingLock. Every later lock() then returned at
the m_attemptingLock check, so the database could not be locked again until
KeePassXC was restarted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@droidmonkey

Copy link
Copy Markdown
Member

Nice find!

@droidmonkey droidmonkey added high priority 🚨 pr: bugfix Pull request fixes a bug labels Sep 30, 2026
@droidmonkey droidmonkey added this to the v2.8.0 milestone Sep 30, 2026
@varjolintu varjolintu added the pr: ai-assisted Pull request contains significant contributions by generative AI label Oct 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

high priority 🚨 pr: ai-assisted Pull request contains significant contributions by generative AI pr: bugfix Pull request fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Database can no longer be locked after a lock whose autosave hit an external change

3 participants