From 858ed06a5772a5509d9db9885d1729f485df0076 Mon Sep 17 00:00:00 2001 From: Taurenkey Date: Sun, 5 Nov 2023 03:22:10 +0000 Subject: [PATCH] [`ImprovedCraftingLog`] Fix Framework Update event handler unsubscribing (#661) --- Tweaks/UiAdjustment/ImprovedCraftingLog.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Tweaks/UiAdjustment/ImprovedCraftingLog.cs b/Tweaks/UiAdjustment/ImprovedCraftingLog.cs index beec005a..963af4c3 100644 --- a/Tweaks/UiAdjustment/ImprovedCraftingLog.cs +++ b/Tweaks/UiAdjustment/ImprovedCraftingLog.cs @@ -124,13 +124,16 @@ private void ForceUpdate() { } private void ForceUpdateFramework() { - if (removeFrameworkUpdateEventStopwatch.ElapsedMilliseconds > 5000) Common.FrameworkUpdate -= ForceUpdateFramework; - ForceUpdate(); + if (removeFrameworkUpdateEventStopwatch.ElapsedMilliseconds > 5000) { + Common.FrameworkUpdate -= ForceUpdateFramework; + removeFrameworkUpdateEventStopwatch.Stop(); + } if (standingUp == false || Service.ClientState.LocalPlayer == null) return; var localPlayer = (Character*) Service.ClientState.LocalPlayer.Address; if (localPlayer->Mode != Character.CharacterModes.Crafting) { standingUp = false; } + ForceUpdate(); } public enum CraftReadyState { @@ -193,6 +196,7 @@ private void ReopenCraftingLog() { agent->OpenRecipeByRecipeId(selectedRecipeId); standingUp = true; + removeFrameworkUpdateEventStopwatch.Restart(); Common.FrameworkUpdate += ForceUpdateFramework; } }