File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed
Plugins/Flow.Launcher.Plugin.BrowserBookmark Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -155,12 +155,18 @@ private void StartFirefoxBookmarkTimer()
155155
156156 _firefoxBookmarkTimer = new PeriodicTimer ( FirefoxPollingInterval ) ;
157157
158+ var timer = _firefoxBookmarkTimer ! ;
158159 _ = Task . Run ( async ( ) =>
159160 {
160- while ( await _firefoxBookmarkTimer . WaitForNextTickAsync ( _cancellationTokenSource . Token ) )
161+ try
161162 {
162- await ReloadFirefoxBookmarksAsync ( ) ;
163+ while ( await timer . WaitForNextTickAsync ( _cancellationTokenSource . Token ) )
164+ {
165+ await ReloadFirefoxBookmarksAsync ( ) ;
166+ }
163167 }
168+ catch ( OperationCanceledException ) { }
169+ catch ( ObjectDisposedException ) { }
164170 } , _cancellationTokenSource . Token ) ;
165171 }
166172
Original file line number Diff line number Diff line change @@ -74,9 +74,11 @@ private void LoadFailedFetches()
7474
7575 private async Task SaveFailedFetchesAsync ( )
7676 {
77- await _fileLock . WaitAsync ( _cts . Token ) ;
77+ var acquired = false ;
7878 try
7979 {
80+ await _fileLock . WaitAsync ( _cts . Token ) ;
81+ acquired = true ;
8082 var json = JsonSerializer . Serialize ( _failedFetches ) ;
8183 await File . WriteAllTextAsync ( _failsFilePath , json , _cts . Token ) ;
8284 }
@@ -87,7 +89,8 @@ private async Task SaveFailedFetchesAsync()
8789 }
8890 finally
8991 {
90- _fileLock . Release ( ) ;
92+ if ( acquired )
93+ _fileLock . Release ( ) ;
9194 }
9295 }
9396
You can’t perform that action at this time.
0 commit comments