Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Segmentation fault when using QML Map and images



  • Hello,
    I'm recently encountering a strange behavior with one of my applications. Basically it became impossible for me to use a QML Map: My application compiles fine without any errors, but immediately crashes during runtime giving me a segmentation fault. I first suspected some issues with my C++ backend code, however after systematically switching off everything related to C++ I was able to narrow down the issue to QML Map.

    The code execution stops here:

    0x7767a225  <+0x0015>        f0 0f ba 30 00           lock btrl $0x0,(%eax)
    

    My first attempt at diagnosing the problem was to run one of the provided map examples, in this case "Map Viewer", which also crashes. Thus I continued by creating a minimal working example with some of the functionalities I wanted my application to have.

    main.qml:

    import QtQuick 2.10
    import QtQuick.Window 2.3
    import QtQuick.Controls 2.2
    import QtQuick.Layouts 1.3
    
    Window {
        id: appMainWindow
        visible: true
        width: 1920
        height: 1080
    
        SwipeView {
            id: swipeView
            currentIndex: 1
            interactive: false
            anchors.bottom: parent.bottom
            anchors.bottomMargin: 300
            anchors.right: parent.right
            anchors.rightMargin: 250
            anchors.left: parent.left
            anchors.leftMargin: 250
            anchors.top: parent.top
            anchors.topMargin: 100
    
            MinimalMap {
    
            }
    
        }
    
    }
    

    MinimalMap.qml:

    import QtQuick 2.10
    import QtLocation 5.9
    import QtPositioning 5.8
    
    Item {
        visible: true
    
        Plugin {
            id: mapPlugin
            name: "osm"
            locales: "en_US"
        }
    
        Map {
            anchors.fill: parent
            plugin: mapPlugin
    
            center: QtPositioning.coordinate(0,0)
            zoomLevel: 14
        }
    }
    

    This example runs and compiles just fine.

    However, when I add an image with:

        Image {
            id: image
            source: "images/logo_full.png"
        }
    

    To my main.qml, the application compiles fine but crashes with the previously described error.
    Once I remove the image or the map the application runs fine again. I suspect a problem with my system, however I have no clue where to start, any help is highly appreciated.

    I'm working with QT 5.10, using MinGW 32-bit.
    Thank you.

    EDIT: I continued playing around with my build configuration and I figured out that my application does not crash when changing the qmake configuration to Release.



  • Hi, welcome to the forum. And thank you for your detailed report. I can't reproduce it on desktop Linux so far. Also I don't have minGW installed on Windows, so it would be great if someone else (cough @mrjj cough) could check it on that platform first before we file an actual bug report.


  • Lifetime Qt Champion

    @Boaschtel said in Segmentation fault when using QML Map and images:

    MinimalMap.qml:

    Hi, how can i run it ?
    Just create a std quick app and copy files?
    Not sure what to do with MinimalMap.qml:

    Anyway, the example "Map Viewer" just crashes
    alt text

    but only with mingw compiler

    with visual studio 2015
    alt text
    it works


Log in to reply