From c3e8aa2edff6559abf45f43df5bde550b97d1200 Mon Sep 17 00:00:00 2001 From: maxim Date: Fri, 16 Oct 2020 23:39:29 +0000 Subject: [PATCH] Reverted r64007 #0c525d9222 from branches/fixes_2_0 (LCL win: detect wincontrol destroy during WindProc / fixes Issue #28404) because it caused crashes git-svn-id: branches/fixes_2_0@64032 - --- lcl/interfaces/win32/win32callback.inc | 40 +------------------------- 1 file changed, 1 insertion(+), 39 deletions(-) diff --git a/lcl/interfaces/win32/win32callback.inc b/lcl/interfaces/win32/win32callback.inc index 282ccb1fea..cfd5607517 100644 --- a/lcl/interfaces/win32/win32callback.inc +++ b/lcl/interfaces/win32/win32callback.inc @@ -294,8 +294,6 @@ type TAccessCustomEdit = class(TCustomEdit); TWindowProcHelper = class - private - procedure SetlWinControl(AValue: TWinControl); private // WindowProc parameters Window: HWnd; // DWord / QWord @@ -305,7 +303,7 @@ type // Other variables LMessage: TLMessage; PLMsg: PLMessage; - FlWinControl: TWinControl; + lWinControl: TWinControl; WinProcess: Boolean; NotifyUserInput: Boolean; WindowInfo: PWin32WindowInfo; @@ -372,16 +370,7 @@ type procedure UpdateLMMovePos(X, Y: Smallint); procedure UpdateUIState(CharCode: Word); function DoWindowProc: LResult; // Called from the actual WindowProc. - property lWinControl: TWinControl read FlWinControl write SetlWinControl; end; - PWindowProcHelper = ^TWindowProcHelper; - - { TWindProcNotificationReceiver } - - TWindProcNotificationReceiver = class - procedure ReceiveDestroyNotify(Sender: TObject); - end; - // Implementation of TWindowProcHelper @@ -500,18 +489,6 @@ begin {$endif} end; -procedure TWindowProcHelper.SetlWinControl(AValue: TWinControl); -begin - if FlWinControl = AValue then Exit; - if FlWinControl <> nil then - FlWinControl.RemoveHandlerOnBeforeDestruction(@TWindProcNotificationReceiver(@Self).ReceiveDestroyNotify); - - FlWinControl := AValue; - - if FlWinControl <> nil then - FlWinControl.AddHandlerOnBeforeDestruction(@TWindProcNotificationReceiver(@Self).ReceiveDestroyNotify); -end; - procedure TWindowProcHelper.CalcClipRgn(PaintRegion: HRGN); var nSize: DWORD; @@ -1949,14 +1926,6 @@ begin end; end; -{ TWindProcNotificationReceiver } - -procedure TWindProcNotificationReceiver.ReceiveDestroyNotify(Sender: TObject); -begin - assert(PWindowProcHelper(Self)^.FlWinControl = Sender, 'TWindProcNotificationReceiver.ReceiveDestroyNotify: PWindowProcHelper(Self)^.FlWinControl = Sender'); - PWindowProcHelper(Self)^.lWinControl := nil; -end; - // This is called from the actual WindowProc. function TWindowProcHelper.DoWindowProc: LResult; @@ -1976,7 +1945,6 @@ const WM_DPICHANGED = $02E0; {$ENDIF} begin - try FillChar(LMessage, SizeOf(LMessage), 0); PLMsg := @LMessage; WinProcess := True; @@ -1989,7 +1957,6 @@ begin end else begin lWinControl := WindowInfo^.WinControl; end; - if (IgnoreNextCharWindow <> 0) and ((Msg = WM_CHAR) or (Msg = WM_SYSCHAR)) then begin if IgnoreNextCharWindow = Window then @@ -2676,10 +2643,6 @@ begin else if PLMsg = @LMNotify then Result := LMNotify.Result else if PLMsg = @LMMouseEvent then Result := LMMouseEvent.Result else Result := PLMsg^.Result; - - finally - lWinControl := nil; - end; end; {------------------------------------------------------------------------------ @@ -2714,7 +2677,6 @@ begin finally Helper.Free; end; - Helper.lWinControl := nil; end; {$ifdef MSG_DEBUG}