mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 21:42:51 +02:00
LCL-Win32: Prevent AV due to message handling after freeing method pointer. Issue #39754, patch by DeerLab.
This commit is contained in:
parent
09584a03b9
commit
0096648e9c
@ -317,9 +317,7 @@ begin
|
|||||||
Here we get the callback WndMethod associated with this window
|
Here we get the callback WndMethod associated with this window
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
PMethod := {%H-}Pointer(Widgetset.GetWindowLong(ahwnd, GWL_USERDATA));
|
PMethod := {%H-}Pointer(Widgetset.GetWindowLong(ahwnd, GWL_USERDATA));
|
||||||
|
|
||||||
if Assigned(PMethod) then PMethod^(Msg);
|
if Assigned(PMethod) then PMethod^(Msg);
|
||||||
|
|
||||||
Windows.DefWindowProc(ahwnd, uMsg, wParam, lParam);
|
Windows.DefWindowProc(ahwnd, uMsg, wParam, lParam);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -469,7 +467,12 @@ begin
|
|||||||
|
|
||||||
This memory is for the TMethod structure allocated on AllocateHWnd
|
This memory is for the TMethod structure allocated on AllocateHWnd
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
if Assigned(PMethod) then Freemem(PMethod);
|
if Assigned(PMethod) then
|
||||||
|
begin
|
||||||
|
Freemem(PMethod);
|
||||||
|
// remove the method pointer
|
||||||
|
Self.SetWindowLong(Wnd, GWL_USERDATA, {%H-}PtrInt(nil));
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TWin32WidgetSet.DestroyRubberBand(ARubberBand: HWND);
|
procedure TWin32WidgetSet.DestroyRubberBand(ARubberBand: HWND);
|
||||||
|
Loading…
Reference in New Issue
Block a user