diff --git a/Dalamud/Hooking/WndProcHook/WndProcHookManager.cs b/Dalamud/Hooking/WndProcHook/WndProcHookManager.cs index 00934f27f0..b62b8d7713 100644 --- a/Dalamud/Hooking/WndProcHook/WndProcHookManager.cs +++ b/Dalamud/Hooking/WndProcHook/WndProcHookManager.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using System.Linq; using System.Runtime.InteropServices; using Dalamud.Interface.Utility; @@ -50,6 +51,10 @@ private unsafe WndProcHookManager() public void Dispose() { this.dispatchMessageWHook.Dispose(); + + // Ensure that either we're on the main thread, or DispatchMessage is executed at least once. + SendMessageW(this.wndProcOverrides.Values.FirstOrDefault()?.Hwnd ?? default(HWND), WM.WM_NULL, 0, 0); + foreach (var v in this.wndProcOverrides.Values) v.InternalRelease(); this.wndProcOverrides.Clear();