Skip to content

Commit 66bc6ed

Browse files
Sachin-NIEpica3055
authored andcommitted
Fix WM_DESTROY message handling (#12648)
* Fix WM_DESTROY message handling * modified condition
1 parent c2270c1 commit 66bc6ed

File tree

1 file changed

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

1 file changed

+4
-4
lines changed

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

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

32353235
private unsafe void DetachAndForward(ref Message m)
32363236
{
3237-
bool isHandleCreated = IsHandleCreated;
3237+
HWND handle = GetHandleNoCreate();
32383238
DetachWindow();
3239-
if (isHandleCreated)
3239+
if (!handle.IsNull)
32403240
{
3241-
void* wndProc = (void*)PInvoke.GetWindowLong(this, WINDOW_LONG_PTR_INDEX.GWL_WNDPROC);
3241+
void* wndProc = (void*)PInvoke.GetWindowLong(handle, WINDOW_LONG_PTR_INDEX.GWL_WNDPROC);
32423242
m.ResultInternal = PInvoke.CallWindowProc(
32433243
(delegate* unmanaged[Stdcall]<HWND, uint, WPARAM, LPARAM, LRESULT>)wndProc,
3244-
HWND,
3244+
handle,
32453245
(uint)m.Msg,
32463246
m.WParamInternal,
32473247
m.LParamInternal);

0 commit comments

Comments
 (0)