Fix caching issue by comparing process ids instead of process objects
This commit is contained in:
parent
520659ac52
commit
bbb0e55ed6
@ -10,7 +10,7 @@ namespace FocusVolumeControl;
|
||||
public class AudioHelper
|
||||
{
|
||||
static object _lock = new object();
|
||||
List<Process> _currentProcesses;
|
||||
int[] _currentProcesses;
|
||||
|
||||
public IAudioSession Current { get; private set; }
|
||||
|
||||
@ -89,8 +89,9 @@ public class AudioHelper
|
||||
lock (_lock)
|
||||
{
|
||||
var processes = GetPossibleProcesses();
|
||||
var processIds = processes.Select(x => x.Id).ToArray();
|
||||
|
||||
if (_currentProcesses == null || !_currentProcesses.SequenceEqual(processes))
|
||||
if (_currentProcesses == null || !_currentProcesses.SequenceEqual(processIds))
|
||||
{
|
||||
Current = FindSession(processes);
|
||||
}
|
||||
@ -107,7 +108,7 @@ public class AudioHelper
|
||||
}
|
||||
}
|
||||
|
||||
_currentProcesses = processes;
|
||||
_currentProcesses = processIds;
|
||||
return Current;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user