From cd1d795eceb75fc70a64922f187603c5a98c3a55 Mon Sep 17 00:00:00 2001 From: Phil Girard Date: Mon, 5 Aug 2024 23:08:09 -0400 Subject: [PATCH] rewrote the interface locking safety --- Source/Frontend/UI/UICore.cs | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/Source/Frontend/UI/UICore.cs b/Source/Frontend/UI/UICore.cs index 8d186356..65d46191 100644 --- a/Source/Frontend/UI/UICore.cs +++ b/Source/Frontend/UI/UICore.cs @@ -188,18 +188,17 @@ public static void UpdateFormFocusStatus(bool? forceSet = null) public static void LockInterface(bool focusCoreForm = true, bool blockMainForm = false) { - if (interfaceLocked || lockPending) - { - return; - } - - lockPending = true; lock (lockObject) { + if (interfaceLocked) + return; + + interfaceLocked = true; + //Kill hotkeys while locked SetHotkeyTimer(false); - interfaceLocked = true; + var cf = S.GET(); cf.LockSideBar(); @@ -224,21 +223,16 @@ public static void LockInterface(bool focusCoreForm = true, bool blockMainForm = cf.Focus(); } } - lockPending = false; } public static void UnlockInterface() { - if (lockPending) - { - lockPending = false; - } - lock (lockObject) { - interfaceLocked = false; - S.GET().UnlockSideBar(); + if (!interfaceLocked) + return; + S.GET().UnlockSideBar(); S.GET().pnBlockedButtons.Hide(); CanvasForm.mainForm.UnblockView(); @@ -251,6 +245,8 @@ public static void UnlockInterface() //Resume hotkeys SetHotkeyTimer(true); + + interfaceLocked = false; } } @@ -302,8 +298,7 @@ internal static void UnblockView(this IBlockable ib) } internal static volatile bool isClosing = false; - private static bool interfaceLocked; - private static bool lockPending; + public static volatile bool interfaceLocked = false; private static object lockObject = new object(); internal static object InputLock = new object();