Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. FileDialog issue - segfault after closing app

FileDialog issue - segfault after closing app

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 464 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Krzysztof
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved