Fix: Project wizard may not close on project creation if there is an error

The error was: "The executable of the QML emulation layer (QML
Puppet) may not be responding. Switching to another kit might help."

This error / warning condition happens in ConnectionManager::setUp()
in plugins/qmldesigner/designercore/instances/connectionmanager.cpp
when puppet fails to start -
connection.qmlPuppetProcess->waitForStarted(waitConstant) returns
false. This opens a warning message box with the parent of it set as
the active window. This active window happens to be the New Project
dialog QQuickWidget. This somehow prevents the QQuickWidget object
from actually closing on `m_dialog->close()` -- the operation returns
true but the dialog is not closed.

Fixing this involves two steps:
1. On "Create project" hide the dialog box before starting to create
the project, so that the parent of the message box would be set to
the main window.
2. deleteLater() on the m_dialog, because, for some reason, even if
the QQuickWidget is no longer its parent and even if m_dialog has
the flag Qt::WA_DeleteOnClose set, the close() still doesn't
close / destroy the dialog box.

If we do only (2) but not (1) then the message box would appear and
disappear quickly when the dialog box closes.

I have also set variables to null just for correctness.

Task-number: QDS-5531
Change-Id: Ib33be6a2de6174b0439cd1917f3e871ee5d4f52f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Samuel Ghinet
2021-11-23 17:14:58 +02:00
parent bdf3fc27a2
commit 300ec4119f
2 changed files with 4 additions and 0 deletions

View File

@@ -63,6 +63,7 @@ void WizardHandler::destroyWizard()
m_selectedProject = -1;
m_wizard->deleteLater();
m_wizard = nullptr;
m_detailsPage = nullptr;
}
void WizardHandler::setupWizard()