mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-17 05:09:55 +02:00
Qt,Qt5: fixed AppRun when called with Application.Terminated - eg. app terminated in mainform.OnShow when using QtUseNativeEventLoop. part of Issue #34982
git-svn-id: branches/fixes_2_0@60289 -
This commit is contained in:
parent
7e5b882e03
commit
2c9ab572d6
@ -297,14 +297,22 @@ var
|
||||
{$ENDIF}
|
||||
begin
|
||||
{$IFDEF QtUseNativeEventLoop}
|
||||
ATimer := QTimer_create(QCoreApplication_instance());
|
||||
if (StyleName = 'gtk') or (StyleName = 'gtk+') then
|
||||
QTimer_setInterval(ATimer, 1) {issue #31191}
|
||||
else
|
||||
QTimer_setInterval(ATimer, 0);
|
||||
QTimer_start(ATimer);
|
||||
FMainTimerID := QTimer_timerId(ATimer);
|
||||
QApplication_exec();
|
||||
if Application.Terminated then
|
||||
begin
|
||||
// application can be terminated in show event of mainform (before AppRun is called - see TApplication.Run. related to #34982)
|
||||
if Assigned(ALoop) then
|
||||
ALoop;
|
||||
end else
|
||||
begin
|
||||
ATimer := QTimer_create(QCoreApplication_instance());
|
||||
if (StyleName = 'gtk') or (StyleName = 'gtk+') then
|
||||
QTimer_setInterval(ATimer, 1) {issue #31191}
|
||||
else
|
||||
QTimer_setInterval(ATimer, 0);
|
||||
QTimer_start(ATimer);
|
||||
FMainTimerID := QTimer_timerId(ATimer);
|
||||
QApplication_exec();
|
||||
end;
|
||||
{$ELSE}
|
||||
// use LCL loop
|
||||
if Assigned(ALoop) then
|
||||
|
@ -474,11 +474,9 @@ begin
|
||||
ACustomForm := TCustomForm(AWinControl);
|
||||
Widget := TQtMainWindow(AWinControl.Handle);
|
||||
|
||||
{$IFNDEF QtUseNativeEventLoop}
|
||||
{issue #34982}
|
||||
if AWinControl.HandleObjectShouldBeVisible and Application.Terminated then
|
||||
exit;
|
||||
{$ENDIF}
|
||||
|
||||
if AWinControl.HandleObjectShouldBeVisible then
|
||||
begin
|
||||
|
@ -245,15 +245,23 @@ var
|
||||
{$ENDIF}
|
||||
begin
|
||||
{$IFDEF QtUseNativeEventLoop}
|
||||
FMainTimerID := -1;
|
||||
ATimer := QTimer_Create(QCoreApplication_instance());
|
||||
if (StyleName = 'gtk') or (StyleName = 'gtk+') then
|
||||
QTimer_setInterval(ATimer, 1) {issue #31191}
|
||||
else
|
||||
QTimer_setInterval(ATimer, {$IFDEF QtCocoa}1{$ELSE} 0 {$ENDIF});
|
||||
QTimer_start(ATimer);
|
||||
FMainTimerID := QTimer_timerId(ATimer);
|
||||
QApplication_exec();
|
||||
if Application.Terminated then
|
||||
begin
|
||||
// application can be terminated in show event of mainform (before AppRun is called - see TApplication.Run. related to #34982)
|
||||
if Assigned(ALoop) then
|
||||
ALoop;
|
||||
end else
|
||||
begin
|
||||
FMainTimerID := -1;
|
||||
ATimer := QTimer_Create(QCoreApplication_instance());
|
||||
if (StyleName = 'gtk') or (StyleName = 'gtk+') then
|
||||
QTimer_setInterval(ATimer, 1) {issue #31191}
|
||||
else
|
||||
QTimer_setInterval(ATimer, {$IFDEF QtCocoa}1{$ELSE} 0 {$ENDIF});
|
||||
QTimer_start(ATimer);
|
||||
FMainTimerID := QTimer_timerId(ATimer);
|
||||
QApplication_exec();
|
||||
end;
|
||||
{$ELSE}
|
||||
// use LCL loop
|
||||
if Assigned(ALoop) then
|
||||
|
@ -479,12 +479,9 @@ begin
|
||||
|
||||
Widget := TQtMainWindow(AWinControl.Handle);
|
||||
|
||||
|
||||
{$IFNDEF QtUseNativeEventLoop}
|
||||
{issue #34982}
|
||||
if AWinControl.HandleObjectShouldBeVisible and Application.Terminated then
|
||||
exit;
|
||||
{$ENDIF}
|
||||
|
||||
if AWinControl.HandleObjectShouldBeVisible then
|
||||
begin
|
||||
|
Loading…
Reference in New Issue
Block a user