Important: Please read the Qt Code of Conduct -

Application exits on second call to

  • My main.qml defines an instance of FileDialog called "fileDialog". The FileDialog is displayed properly the first time is invoked. However the next time is invoked, the application exits. It does NOT core dump. I see this behavior whether or not I actually select a file, or choose "Cancel". My main.qml also defines a MessageDialog called "quitDialog", which can be invoked multiple times with no problem. Why does my application exit the second time is invoked? I am running Qt 5.14.2 on Ubuntu 18.04.4.

    Here's main.qml:

    import QtQuick 2.12
    import QtQuick.Window 2.12
    import QtQuick 2.9
    import QtQuick.Controls 2.3
    import QtQuick.Dialogs 1.1
    ApplicationWindow {
        visible: true
        width: 640
        height: 480
        title: qsTr("Hello World")
        menuBar: MenuBar {
            Menu {
                title: "File"
                Action { text: "Open grid" ;
                    onTriggered: { console.log("show file dialog")
                Action { text: "Exit" ;
                    onTriggered: { console.log("exit");
        FileDialog {
             id: fileDialog
             title: "Open file"
             nameFilters: ["Grid files (*.grd)"]
             onAccepted: {
                 console.log("accepted " + fileUrl);
        MessageDialog {
              id: quitDialog
              title: "Quit?"
              icon: StandardIcon.Question
              text: "Quit application?"
              standardButtons: StandardButton.Yes |
              Component.onCompleted: visible = false
              onYes: Qt.quit(0)
              onNo: console.log("did not quit")

    My main.cpp is also very simple, and was auto-generated with qtcreator:

    #include <QGuiApplication>
    #include <QQmlApplicationEngine>
    int main(int argc, char *argv[])
        QGuiApplication app(argc, argv);
        QQmlApplicationEngine engine;
        const QUrl url(QStringLiteral("qrc:/main.qml"));
        QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
                         &app, [url](QObject *obj, const QUrl &objUrl) {
            if (!obj && url == objUrl)
        }, Qt::QueuedConnection);
        return app.exec();


  • Solved: my application generated this error message on exit:
    relocation error: /home/oreilly/Qt5.14.2/5.14.2/gcc_64/plugins/platformthemes/ symbol _ZdlPvm version Qt_5 not defined in file with link time reference

    This message indicates that the application was compiled and linked with different flags that compiled the Qt5.14.2 libraries. I've recompiled the libraries, and now can call multiple times without a problem.

Log in to reply