mirror of
https://github.com/kangyu-california/PersistentWindows.git
synced 2025-05-12 13:35:39 +02:00
attempt to fix exception using lock
This commit is contained in:
parent
96caaa9cd8
commit
b758dfed2d
1 changed files with 4 additions and 0 deletions
|
@ -97,6 +97,7 @@ namespace PersistentWindows.Common
|
||||||
private POINT initCursorPos;
|
private POINT initCursorPos;
|
||||||
private bool freezeCapture = false;
|
private bool freezeCapture = false;
|
||||||
public bool rejectScaleFactorChange = true;
|
public bool rejectScaleFactorChange = true;
|
||||||
|
private Object captureLock = new object();
|
||||||
|
|
||||||
// restore control
|
// restore control
|
||||||
private Timer restoreTimer;
|
private Timer restoreTimer;
|
||||||
|
@ -1285,6 +1286,7 @@ namespace PersistentWindows.Common
|
||||||
uint pid;
|
uint pid;
|
||||||
User32.GetWindowThreadProcessId(realHwnd, out pid);
|
User32.GetWindowThreadProcessId(realHwnd, out pid);
|
||||||
|
|
||||||
|
lock(captureLock)
|
||||||
foreach (var display_key in deadApps.Keys)
|
foreach (var display_key in deadApps.Keys)
|
||||||
{
|
{
|
||||||
if (deadApps[display_key].ContainsKey(kid))
|
if (deadApps[display_key].ContainsKey(kid))
|
||||||
|
@ -1363,6 +1365,7 @@ namespace PersistentWindows.Common
|
||||||
IntPtr pos_match_hid = IntPtr.Zero;
|
IntPtr pos_match_hid = IntPtr.Zero;
|
||||||
|
|
||||||
var deadAppPos = deadApps[curDisplayKey];
|
var deadAppPos = deadApps[curDisplayKey];
|
||||||
|
lock(captureLock)
|
||||||
foreach (var kid in deadAppPos.Keys)
|
foreach (var kid in deadAppPos.Keys)
|
||||||
{
|
{
|
||||||
var appPos = deadAppPos[kid].Last<ApplicationDisplayMetrics>();
|
var appPos = deadAppPos[kid].Last<ApplicationDisplayMetrics>();
|
||||||
|
@ -1759,6 +1762,7 @@ namespace PersistentWindows.Common
|
||||||
dualPosSwitchWindows.Remove(hwnd);
|
dualPosSwitchWindows.Remove(hwnd);
|
||||||
|
|
||||||
bool found_history = false;
|
bool found_history = false;
|
||||||
|
lock(captureLock)
|
||||||
foreach (var display_config in monitorApplications.Keys)
|
foreach (var display_config in monitorApplications.Keys)
|
||||||
{
|
{
|
||||||
if (!monitorApplications[display_config].ContainsKey(hwnd))
|
if (!monitorApplications[display_config].ContainsKey(hwnd))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue