mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-01-18 06:29:44 +08:00
Warning CA2002 Do not lock on objects with weak identity PowerLauncher C:\Repos\PowerToys\src\modules\launcher\PowerLauncher\SettingsWatcher.cs 43 Active
This commit is contained in:
parent
fd6525a9de
commit
d2c1be5c2d
@ -19,6 +19,7 @@ namespace PowerLauncher
|
||||
public class SettingsWatcher : BaseModel
|
||||
{
|
||||
private static int MAX_RETRIES = 10;
|
||||
private static object _watcherSyncObject = new object();
|
||||
private FileSystemWatcher _watcher;
|
||||
private Settings _settings;
|
||||
public SettingsWatcher(Settings settings)
|
||||
@ -40,7 +41,7 @@ namespace PowerLauncher
|
||||
|
||||
public void OverloadSettings()
|
||||
{
|
||||
Monitor.Enter(_watcher);
|
||||
Monitor.Enter(_watcherSyncObject);
|
||||
var retry = true;
|
||||
for (int i = 0; retry && i < MAX_RETRIES; i++)
|
||||
{
|
||||
@ -79,7 +80,7 @@ namespace PowerLauncher
|
||||
Debug.WriteLine(e.Message);
|
||||
}
|
||||
}
|
||||
Monitor.Exit(_watcher);
|
||||
Monitor.Exit(_watcherSyncObject);
|
||||
}
|
||||
|
||||
private static string ConvertHotkey(HotkeySettings hotkey)
|
||||
|
Loading…
Reference in New Issue
Block a user