keepassxreboot / keepassxc

KeePassXC is a cross-platform community-driven port of the Windows application “Keepass Password Safe”.
https://keepassxc.org/
Other
20.82k stars 1.44k forks source link

Unsaved changes are thrown away when choosen not to #10778

Open OakLD opened 4 months ago

OakLD commented 4 months ago

Overview

Unsaved changes are thrown away

Steps to Reproduce

  1. Create new entry or make changes in KeepasXC
  2. Lock the screen
  3. Unlock the screen and get focus back on KeepasXC window
  4. A message appears stating (translated from Czech): Item is being modified. Close despite that and throw away changes? Two options are given "Throw away" and "Cancel". Selecting any of them results in KeepasXC getting locked and changes are lost.

Expected Behavior

When hitting "Cancel" [Action], the process described in the dialog - throwing away data - should be cancelled. When clicking on "Throw away", changes should be thrown away.

Actual Behavior

Data are lost thrown away with either "Throw away" and "Cancel" option.

Context

KeePassXC - KeepasXC 2.7.8 Revision: f6757d3

Operating System: Linux Desktop Env: KDE Windowing System: Wayland

droidmonkey commented 3 months ago

I cannot replicate this at all

OakLD commented 3 months ago

I can easily replicate it. I wasn't able to do it with a simple lock now, but putting a session to sleep and waking it back resulted in exactly this behavior. I'm quite sure it happens from lock as well, since it happens on my desktop as well, where I don't use sleep mode. I'v lost data at least 10 times on 2 different machine (over years). I know about the bug for a long time, but sometimes forget to save changes in the middle of things...

droidmonkey commented 3 months ago

Locking is locking, doesn't matter what triggers it, it's all calling the same code.

OakLD commented 3 months ago

Perhaps, but I've just reproduced that on 2nd computer the same way - putting it to sleep and waking up.

OakLD commented 3 months ago

And on the 3rd computer, also a desktop PC with OpenSuSE Leap 15.5. So 100% success when putting/letting computers to sleep. On "Cancel" the app locks and wants password and looses data.

droidmonkey commented 3 months ago

I'll try it again

droidmonkey commented 3 months ago

I still cannot replicate this after going to sleep. When I click cancel upon resume from sleep the database does not lock (expected). If I click Discard then the database attempts to lock but will prompt to save if there are unsaved changes (expected). I am testing this on Windows, but there is absolutely no difference in the code for this behavior between Windows and Linux.

OakLD commented 3 months ago

I wish I could further help with your effort, but that's about all I observed so far. The only thing is, that with putting it to sleep, I noticed the "Throw Away" + "Cancel" dialog comes before the computer locks and then when woke up, it's still visible, but in a second is replaced with login dialog (and the changes are lost).