diff --git a/lcl/interfaces/win32/win32wsspin.pp b/lcl/interfaces/win32/win32wsspin.pp index 5f5c2c42bf..79705f54f7 100644 --- a/lcl/interfaces/win32/win32wsspin.pp +++ b/lcl/interfaces/win32/win32wsspin.pp @@ -374,7 +374,8 @@ end; class procedure TWin32WSCustomFloatSpinEdit.SetFont( const AWinControl: TWinControl; const AFont: TFont); begin - inherited SetFont(AWinControl, AFont); + if not WSCheckHandleAllocated(AWinControl, 'SetFont') then Exit; + TWin32WSWinControl.SetFont(AWinControl, AFont); ApplyMargins(AWinControl); end; diff --git a/lcl/interfaces/win32/win32wsstdctrls.pp b/lcl/interfaces/win32/win32wsstdctrls.pp index ccf15cd95c..93d3f9dd54 100644 --- a/lcl/interfaces/win32/win32wsstdctrls.pp +++ b/lcl/interfaces/win32/win32wsstdctrls.pp @@ -1242,7 +1242,8 @@ end; class procedure TWin32WSCustomEdit.SetFont(const AWinControl: TWinControl; const AFont: TFont); begin - inherited SetFont(AWinControl, AFont); + if not WSCheckHandleAllocated(AWinControl, 'SetFont') then Exit; + TWin32WSWinControl.SetFont(AWinControl, AFont); ApplyMargins(AWinControl); end;