Unsolved Scatter 3D application won't close
-
Hey all,
I have an issue where I'm using a Scatter3D plot inside a QML application on Windows 7 64-bit. When I close the application by clicking on the "x" in the upper-right the application just hangs indefinitely. I noticed the issue when I switched from Qt 5.11.0 (MinGW 32-bit) to Qt 5.11.1 and have verified it also exists in Qt 5.12 (MinGW 64-bit).
I reviewed the data visualization examples provided by Qt and it seems to be an issue with using QQmlApplicationEngine (default for new "Qt Quick Application - Empty" project) and QQuickView (default for Qt data visualization examples).
Does anyone know how to make the application gracefully close when using a Scatter3D item?
I create a bug report this back in July 2018, but nothing has been done about it. I hoping this gets some visibility.
https://bugreports.qt.io/browse/QTBUG-69627Below is an example to recreate the issue.
main.qml
import QtQuick 2.6 import QtQuick.Window 2.2 import QtDataVisualization 1.2 Window { visible: true width: 640 height: 480 title: qsTr("Hello World") Scatter3D { id: chartView anchors.fill: parent } }
main.cpp (untouched after creating project)
#include <QGuiApplication> #include <QQmlApplicationEngine> int main(int argc, char *argv[]) { QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QGuiApplication app(argc, argv); QQmlApplicationEngine engine; engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); if (engine.rootObjects().isEmpty()) return -1; return app.exec(); }
-
I was able to narrow down the issue to the destructors of QQmlApplicationEngine and QGuiApplication. I found that if I put those two objects on the heap, the application is able to exit properly. This seems like I'm skirting the real underlying issue, but I'll take it for now. Are there any downsides to not calling the destructors of QQmlApplicationEngine and QGuiApplication?
Updates to code:
main.cpp
#include <QGuiApplication> #include <QQmlApplicationEngine> int main(int argc, char *argv[]) { QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QGuiApplication *app = new QGuiApplication(argc, argv); QQmlApplicationEngine *engine = new QQmlApplicationEngine(); engine->load(QUrl(QStringLiteral("qrc:/main.qml"))); if (engine->rootObjects().isEmpty()) return -1; return app->exec(); }