mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01: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:
@@ -19,6 +19,7 @@ namespace PowerLauncher
|
|||||||
public class SettingsWatcher : BaseModel
|
public class SettingsWatcher : BaseModel
|
||||||
{
|
{
|
||||||
private static int MAX_RETRIES = 10;
|
private static int MAX_RETRIES = 10;
|
||||||
|
private static object _watcherSyncObject = new object();
|
||||||
private FileSystemWatcher _watcher;
|
private FileSystemWatcher _watcher;
|
||||||
private Settings _settings;
|
private Settings _settings;
|
||||||
public SettingsWatcher(Settings settings)
|
public SettingsWatcher(Settings settings)
|
||||||
@@ -40,7 +41,7 @@ namespace PowerLauncher
|
|||||||
|
|
||||||
public void OverloadSettings()
|
public void OverloadSettings()
|
||||||
{
|
{
|
||||||
Monitor.Enter(_watcher);
|
Monitor.Enter(_watcherSyncObject);
|
||||||
var retry = true;
|
var retry = true;
|
||||||
for (int i = 0; retry && i < MAX_RETRIES; i++)
|
for (int i = 0; retry && i < MAX_RETRIES; i++)
|
||||||
{
|
{
|
||||||
@@ -79,7 +80,7 @@ namespace PowerLauncher
|
|||||||
Debug.WriteLine(e.Message);
|
Debug.WriteLine(e.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Monitor.Exit(_watcher);
|
Monitor.Exit(_watcherSyncObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string ConvertHotkey(HotkeySettings hotkey)
|
private static string ConvertHotkey(HotkeySettings hotkey)
|
||||||
|
|||||||
Reference in New Issue
Block a user