Qt6: fix crash if push button is destroyed or recreated inside mouserelease event.

This commit is contained in:
zeljan1 2025-05-10 12:21:25 +02:00
parent 61e7ffa811
commit e483b7fa0b

View File

@ -6284,13 +6284,18 @@ begin
case QEvent_type(Event) of
QEventMouseButtonRelease:
begin
Result := SlotMouse(Sender, Event);
if not QWidget_hasFocus(Widget) and
(QMouseEvent_button(QMouseEventH(Event)) = QtLeftButton) and
(QWidget_focusPolicy(Widget) > QtNoFocus) then
begin
QObject_blockSignals(Sender, True);
Application.QueueAsyncCall(@PushButtonUnblock, PtrInt(Self));
BeginEventProcessing;
try
Result := SlotMouse(Sender, Event);
if not QWidget_hasFocus(Widget) and
(QMouseEvent_button(QMouseEventH(Event)) = QtLeftButton) and
(QWidget_focusPolicy(Widget) > QtNoFocus) then
begin
QObject_blockSignals(Sender, True);
Application.QueueAsyncCall(@PushButtonUnblock, PtrInt(Self));
end;
finally
EndEventProcessing;
end;
end;
else