Skip to content

Commit

Permalink
Fix WM_DESTROY message handling (#12648)
Browse files Browse the repository at this point in the history
* Fix WM_DESTROY message handling

* modified condition
  • Loading branch information
Sachin-NI authored Dec 17, 2024
1 parent d10af20 commit af50c4b
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3204,14 +3204,14 @@ protected override unsafe void WndProc(ref Message m)

private unsafe void DetachAndForward(ref Message m)
{
bool isHandleCreated = IsHandleCreated;
HWND handle = GetHandleNoCreate();
DetachWindow();
if (isHandleCreated)
if (!handle.IsNull)
{
void* wndProc = (void*)PInvokeCore.GetWindowLong(this, WINDOW_LONG_PTR_INDEX.GWL_WNDPROC);
void* wndProc = (void*)PInvokeCore.GetWindowLong(handle, WINDOW_LONG_PTR_INDEX.GWL_WNDPROC);
m.ResultInternal = PInvokeCore.CallWindowProc(
(delegate* unmanaged[Stdcall]<HWND, uint, WPARAM, LPARAM, LRESULT>)wndProc,
HWND,
handle,
(uint)m.Msg,
m.WParamInternal,
m.LParamInternal);
Expand Down

0 comments on commit af50c4b

Please sign in to comment.