Skip to content

Commit 75defd5

Browse files
Sachin-NIEpica3055
authored andcommitted
Fix WM_DESTROY message handling (#12648)
* Fix WM_DESTROY message handling * modified condition
1 parent 5d9bd8e commit 75defd5

File tree

1 file changed

+4
-4
lines changed
  • src/System.Windows.Forms/src/System/Windows/Forms

1 file changed

+4
-4
lines changed

src/System.Windows.Forms/src/System/Windows/Forms/AxHost.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3370,14 +3370,14 @@ protected override unsafe void WndProc(ref Message m)
33703370

33713371
private unsafe void DetachAndForward(ref Message m)
33723372
{
3373-
bool isHandleCreated = IsHandleCreated;
3373+
HWND handle = GetHandleNoCreate();
33743374
DetachWindow();
3375-
if (isHandleCreated)
3375+
if (!handle.IsNull)
33763376
{
3377-
void* wndProc = (void*)PInvoke.GetWindowLong(this, WINDOW_LONG_PTR_INDEX.GWL_WNDPROC);
3377+
void* wndProc = (void*)PInvoke.GetWindowLong(handle, WINDOW_LONG_PTR_INDEX.GWL_WNDPROC);
33783378
m.ResultInternal = PInvoke.CallWindowProc(
33793379
(delegate* unmanaged[Stdcall]<HWND, uint, WPARAM, LPARAM, LRESULT>)wndProc,
3380-
HWND,
3380+
handle,
33813381
(uint)m.Msg,
33823382
m.WParamInternal,
33833383
m.LParamInternal);

0 commit comments

Comments
 (0)