FileDialog issue - segfault after closing app



  • I have this small example app that causes a crash. The app uses PyQt5.

    main.py

    import sys
    from PyQt5.QtCore import QUrl
    from PyQt5.QtGui import QGuiApplication
    from PyQt5.QtQml import QQmlApplicationEngine
    
    
    def run():
        app = QGuiApplication(sys.argv)
    
        engine = QQmlApplicationEngine()
        engine.load(QUrl('main.qml'))
    
        if not engine.rootObjects():
            return -1
    
        return app.exec_()
    
    
    if __name__ == '__main__':
    sys.exit(run())
    

    main.qml

    import QtQuick 2.7
    import QtQuick.Controls 2.0
    import QtQuick.Layouts 1.3
    import QtQuick.Dialogs 1.2
    
    ApplicationWindow {
        visible: true
        width: 640
        height: 480
        title: qsTr("Hello World")
    
        FileDialog {
            id: fileDialog
            selectFolder: true
    
            onAccepted: {
                console.log('activated')
            }
        }
    
        Button {
            anchors.centerIn: parent
            text: "Open"
            onClicked: {
                fileDialog.open()
            }
        }
    }
    

    To cause the crash, simply open the app, click the button, select a directory, accept and then close the app.

    The console shows a warning message:
    QObject::startTimer: Timers can only be used with threads started with QThread

    and then the app just crashes.
    Any clues why or how to get an error message/stack trace?

    Checked on 2 environments:
    Windows 10, python 3.6.1, PyQt5 5.9
    Arch Linux (4.12.4-1-ARCH), python 3.6.2, PyQt5 5.9


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.