Question

Recently I installed Qt 5.2. and after playing around I discovered that most visual components in Qt Quick who have some sort of drop down functionality (e.g combo boxes, menu bar items) crash the program when I choose something from them. same thing applied for my projects that worked file in 5.1. I googled the problem but nothing useful came up.
I'm running it on a ubuntu 12.04 64bit. and this is a sample code that crashes by receiving SIGSEGV when I use the "File" item in the menu bar and the same thing happens when the combo box is used.

import QtQuick 2.0
import QtQuick.Controls 1.0

ApplicationWindow {
    title: qsTr("Hello World")
    width: 640
    height: 480
    ComboBox {
        id: combo
        model: [1, 2, 3]
    }

    menuBar: MenuBar {
        Menu {
            title: qsTr("File")
            MenuItem {
                text: qsTr("Exit")
                onTriggered: Qt.quit();
            }
        }
    }

    Button {
        text: qsTr("Hello World")
        anchors.centerIn: parent
    }
}


Update:

this is the stack
0 ?? 0x21
1 QOpenGLContext::makeCurrent(QSurface*) /home/abo0ody/Qt5.2.0/5.2.0/gcc_64/lib/libQt5Gui.so.5 0x7ffff6482f4b
2 ?? /home/abo0ody/Qt5.2.0/5.2.0/gcc_64/lib/libQt5Quick.so.5 0x7ffff79a2dfc
3 ?? /home/abo0ody/Qt5.2.0/5.2.0/gcc_64/lib/libQt5Quick.so.5 0x7ffff79a30da
4 ?? /home/abo0ody/Qt5.2.0/5.2.0/gcc_64/lib/libQt5Quick.so.5 0x7ffff79a392e
5 ?? /home/abo0ody/Qt5.2.0/5.2.0/gcc_64/lib/libQt5Quick.so.5 0x7ffff79a3a92
6 ?? /home/abo0ody/Qt5.2.0/5.2.0/gcc_64/lib/libQt5Core.so.5 0x7ffff5d3bf38
7 start_thread pthread_create.c 308 0x7ffff4959e9a
8 clone clone.S 112 0x7ffff54bc3fd
9 ??


the kit that I'm running it with was auto detected and it's version name is "Qt 5.2.0 GCC 64bit" with the qmake location "/home/UserName/Qt5.2.0/5.2.0/gcc_64/bin/qmake".
I run it normally by pressing the run button.
g++ version is "g++ (Ubuntu 4.8.1-2ubuntu1~12.04) 4.8.1".

Update:

Here is a simple main.cpp that can load the QML file by default or take an argument from the command line that specifies the path to a QML file to load, As Laszlo Papp suggested. But it still reproduces the same error for me.

#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQuickWindow>

int main (int argc, char *argv[])
{
    QString pathToMainQML = "qml/testdrop/main.qml"; // if no command line argument is specified this qml file will be used
    QGuiApplication app(argc, argv);
    QQmlApplicationEngine engine;
    engine.load(argc > 1 ? argv[1] : pathToMainQML);
    QObject *topLevel = engine.rootObjects().value(0);
    QQuickWindow *window = qobject_cast<QQuickWindow *>(topLevel);
    window->show();
    return app.exec();
}
Was it helpful?

Solution

This is a bug in Qt 5.2 and I have already reported it. A work around could be to set an environment variable "QSG_RENDER_LOOP=basic" in your system environment. For more details see QTBUG-35989 and qt forum discussion

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top