Skip to content

Commit

Permalink
Safer unload
Browse files Browse the repository at this point in the history
  • Loading branch information
Soreepeong committed Dec 17, 2023
1 parent 0afb3d2 commit 51ef376
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Dalamud/Hooking/WndProcHook/WndProcHookManager.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;

using Dalamud.Interface.Utility;
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 51ef376

Please sign in to comment.