Squish: Avoid potential crashes

The control bar of the Squish plugin is used as top level
widget, but may get destroyed out of the sudden under several
circumstances.
If some dialog is using the control bar as parent QC will crash
at this point.
Redo 0d7bbb8480 to avoid all crashes instead of just
this specific one.

Change-Id: I5c5de737d748fe8eee724e9fa489696a27300978
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Christian Stenger
2022-09-14 09:22:45 +02:00
parent a484f3fef5
commit 60f11cf637
3 changed files with 3 additions and 3 deletions

View File

@@ -688,7 +688,7 @@ QWidget *ICore::dialogParent()
QWidget *active = QApplication::activeModalWidget();
if (!active)
active = QApplication::activeWindow();
if (!active || (active && active->windowFlags().testFlag(Qt::SplashScreen)))
if (!active || (active && active->windowFlags().testAnyFlags(Qt::SplashScreen | Qt::Popup)))
active = m_mainwindow;
return active;
}

View File

@@ -126,7 +126,7 @@ SquishControlBar::SquishControlBar(SquishPerspective *perspective)
, m_perspective(perspective)
{
setWindowTitle(Tr::tr("Control Bar"));
setWindowFlags(Qt::Widget | Qt::WindowCloseButtonHint | Qt::WindowStaysOnTopHint);
setWindowFlags(Qt::Tool | Qt::WindowCloseButtonHint | Qt::WindowStaysOnTopHint);
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->setContentsMargins(0, 0, 0, 0);

View File

@@ -367,7 +367,7 @@ void SquishTools::setState(SquishTools::State state)
QDir(m_suitePath).dirName(),
&error);
if (!error.isEmpty())
QMessageBox::critical(Core::ICore::mainWindow(), Tr::tr("Error"), error);
QMessageBox::critical(Core::ICore::dialogParent(), Tr::tr("Error"), error);
logrotateTestResults();
} else {
m_xmlOutputHandler->clearForNextRun();