Skip to content

Commit dc82f30

Browse files
authored
Fix: Fixed ArgumentException in PinnedFoldersManager (#15817)
1 parent 8097ba8 commit dc82f30

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

src/Files.App/Data/Models/PinnedFoldersManager.cs

-2
Original file line numberDiff line numberDiff line change
@@ -189,13 +189,11 @@ public void RemoveStaleSidebarItems()
189189

190190
public async void LoadAsync(object? sender, FileSystemEventArgs e)
191191
{
192-
App.QuickAccessManager.PinnedItemsWatcher.EnableRaisingEvents = false;
193192
await LoadAsync();
194193
App.QuickAccessManager.UpdateQuickAccessWidget?.Invoke(null, new ModifyQuickAccessEventArgs((await QuickAccessService.GetPinnedFoldersAsync()).ToArray(), true)
195194
{
196195
Reset = true
197196
});
198-
App.QuickAccessManager.PinnedItemsWatcher.EnableRaisingEvents = true;
199197
}
200198

201199
public async Task LoadAsync()

src/Files.App/Services/Windows/WindowsJumpListService.cs

+6
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ public async Task RefreshPinnedFoldersAsync()
8080
{
8181
try
8282
{
83+
App.QuickAccessManager.PinnedItemsWatcher.EnableRaisingEvents = false;
84+
8385
if (JumpList.IsSupported())
8486
{
8587
var instance = await JumpList.LoadCurrentAsync();
@@ -98,6 +100,10 @@ public async Task RefreshPinnedFoldersAsync()
98100
catch
99101
{
100102
}
103+
finally
104+
{
105+
App.QuickAccessManager.PinnedItemsWatcher.EnableRaisingEvents = true;
106+
}
101107
}
102108

103109
public async Task RemoveFolderAsync(string path)

src/Files.App/Utils/Global/QuickAccessManager.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ public void Initialize()
3030
{
3131
Path = Path.Join(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Microsoft", "Windows", "Recent", "AutomaticDestinations"),
3232
Filter = "f01b4d95cf55d32a.automaticDestinations-ms",
33-
NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite | NotifyFilters.FileName,
34-
EnableRaisingEvents = true
33+
NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite | NotifyFilters.FileName
3534
};
3635

3736
PinnedItemsWatcher.Changed += PinnedItemsWatcher_Changed;

0 commit comments

Comments
 (0)