From cfb94a8c5b899d5c0f3397054ec2e3a0cdeadd21 Mon Sep 17 00:00:00 2001 From: ArtyoZ <43533126+ArtyoZ@users.noreply.github.com> Date: Fri, 18 Sep 2026 13:04:15 +0300 Subject: [PATCH 1/2] Improve database unlock handling in Handlers.cs Refactor unlock database logic to check for open dialogs. --- KeePassNatMsg/Protocol/Handlers.cs | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/KeePassNatMsg/Protocol/Handlers.cs b/KeePassNatMsg/Protocol/Handlers.cs index e39565f..bcf37e2 100644 --- a/KeePassNatMsg/Protocol/Handlers.cs +++ b/KeePassNatMsg/Protocol/Handlers.cs @@ -63,9 +63,25 @@ private bool UnlockDatabase(bool triggerUnlock) lock (_unlockLock) { var config = new ConfigOpt(_host.CustomConfig); - if (!_host.Database.IsOpen && config.UnlockDatabaseRequest && KeePass.UI.GlobalWindowManager.WindowCount == 0 && triggerUnlock) + if (!_host.Database.IsOpen && config.UnlockDatabaseRequest && triggerUnlock) { - _host.MainWindow.Invoke(new System.Action(() => _host.MainWindow.OpenDatabase(_host.MainWindow.DocumentManager.ActiveDocument.LockedIoc, null, false))); + _host.MainWindow.Invoke(new System.Action(() => + { + if (KeePass.UI.GlobalWindowManager.WindowCount == 0) + { + // No dialog open yet for this database — start a fresh one. + _host.MainWindow.OpenDatabase(_host.MainWindow.DocumentManager.ActiveDocument.LockedIoc, null, false); + } + else + { + // A dialog (likely the master-key prompt from an earlier + // triggerUnlock, or KeePass's own auto-lock prompt) may + // already be open but hidden behind other windows. + // Bring KeePass to the foreground so the user actually + // sees it, instead of silently doing nothing. + _host.MainWindow.Activate(); + } + })); } return _host.Database.IsOpen; From de6631b0ecdb472ac358bf371dfd6474f721fcf8 Mon Sep 17 00:00:00 2001 From: ArtyoZ <43533126+ArtyoZ@users.noreply.github.com> Date: Sat, 19 Sep 2026 19:32:17 +0300 Subject: [PATCH 2/2] Update AssemblyInfo.cs Fix build number --- KeePassNatMsg/Properties/AssemblyInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KeePassNatMsg/Properties/AssemblyInfo.cs b/KeePassNatMsg/Properties/AssemblyInfo.cs index 9eb585c..24ad7ef 100644 --- a/KeePassNatMsg/Properties/AssemblyInfo.cs +++ b/KeePassNatMsg/Properties/AssemblyInfo.cs @@ -31,4 +31,4 @@ // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("2.0.13")] \ No newline at end of file +[assembly: AssemblyVersion("2.0.17")]