From c75cb1acecf0ba8df2d180e6cf6f7977a9a358c1 Mon Sep 17 00:00:00 2001 From: Andrzej Martyna Date: Fri, 2 Jan 2026 20:00:04 +0100 Subject: [PATCH] Resolved: a few PR issues reported by coderabbitai --- .../Tabs/TabsCache.cs | 6 ++-- .../Tabs/TabsReservationService.cs | 29 ++++++++++++------- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Tabs/TabsCache.cs b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Tabs/TabsCache.cs index 52de5ed5d..432b62e54 100644 --- a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Tabs/TabsCache.cs +++ b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Tabs/TabsCache.cs @@ -123,10 +123,10 @@ public class TabsCache _indexToElement[newIndex] = tabToAdd; } - foreach (var tabtoRevive in tabsToRevive) + foreach (var tabToRevive in tabsToRevive) { - Context.API.LogDebug(ClassName, $"TABS:Reset age of {TryName(tabtoRevive.Key)} as it appeared again"); - _elementToInfo[tabtoRevive.Key].Age = 0; + Context.API.LogDebug(ClassName, $"TABS:Reset age of {TryName(tabToRevive.Key)} as it appeared again"); + _elementToInfo[tabToRevive.Key].Age = 0; } Valid = true; diff --git a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Tabs/TabsReservationService.cs b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Tabs/TabsReservationService.cs index 7f3549e11..d48a63d62 100644 --- a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Tabs/TabsReservationService.cs +++ b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Tabs/TabsReservationService.cs @@ -144,20 +144,27 @@ public class TabsReservationService : IDisposable { lock (_sync) { - var currentTab = new BrowserTab + try { - Title = tab.Current.Name, - BrowserName = trackingInfo.ProcessName, - Hwnd = trackingInfo.ProcessMainWindowHandle, - AutomationElement = tab - }; + var currentTab = new BrowserTab + { + Title = tab.Current.Name, + BrowserName = trackingInfo.ProcessName, + Hwnd = trackingInfo.ProcessMainWindowHandle, + AutomationElement = tab + }; - Context.API.LogDebug(ClassName, $"TABS:{RuntimeIdToKey(currentTab.AutomationElement)}:Registering {url} as tab: {currentTab.Title}"); - _urlToBrowserTab[url] = currentTab; - _automationElementToUrl[currentTab.AutomationElement] = url; + Context.API.LogDebug(ClassName, $"TABS:{RuntimeIdToKey(currentTab.AutomationElement)}:Registering {url} as tab: {currentTab.Title}"); + _urlToBrowserTab[url] = currentTab; + _automationElementToUrl[currentTab.AutomationElement] = url; - // required to take the tab into account by Flow Launcher main UI search window - Context.API.ReQuery(); + // required to take the tab into account by Flow Launcher main UI search window + Context.API.ReQuery(); + } + catch (ElementNotAvailableException) + { + Context.API.LogDebug(ClassName, $"TABS:Tab became unavailable before registration for {url}"); + } } }