Qt5, Qt6: guard TQtWSWinControl.SetText from dangling pointers in same way as TQtWSWinControl.GetText

(cherry picked from commit f2f43ea7fa)

Co-authored-by: Željan Rikalo <zeljko@lazarus-ide.org>
This commit is contained in:
Željan Rikalo 2024-11-22 07:10:09 +00:00 committed by Željan Rikalo
parent 342f30c518
commit 0e38dd49d1
2 changed files with 4 additions and 0 deletions

View File

@ -360,6 +360,8 @@ var
begin
if not WSCheckHandleAllocated(AWincontrol, 'SetText') then
Exit;
if not QtWidgetSet.IsValidHandle(AWinControl.Handle) then
exit;
Wdgt := TQtWidget(AWinControl.Handle);
Wdgt.BeginUpdate;
Wdgt.setText(AText{%H-});

View File

@ -358,6 +358,8 @@ var
begin
if not WSCheckHandleAllocated(AWincontrol, 'SetText') then
Exit;
if not QtWidgetSet.IsValidHandle(AWinControl.Handle) then
exit;
Wdgt := TQtWidget(AWinControl.Handle);
Wdgt.BeginUpdate;
Wdgt.setText(AText{%H-});