QtQuick 2 application crash

  • QtQuick 2 application crash with such code

    class Root : public QObject {
    Q_PROPERTY( SubClass sub ...... ) // With setter and getter and update signal
    .... // other code

    class SubClass : public QObject {
    Q_PORPERTY( QList<Qobject*> listOfsubObjects )


    And then in main cpp expose root class by

    QGuiApplication app(argc, argv);
    QtQuick2ApplicationViewer viewer;

    And then in qml

    ListView {
    model: root.sub.listOfsubObjects // Crash happend here

    Debug shows :

    0 QV8QObjectWrapper::newQObject(QObject*) /home/developer/bin/Qt/5.1.1/gcc/lib/libQt5Qml.so.5 0xb7bd0b8a
    1 QV8Engine::fromVariant(QVariant const&) /home/developer/bin/Qt/5.1.1/gcc/lib/libQt5Qml.so.5 0xb7bb2aa3
    2 QV8QObjectWrapper::GetProperty(QV8Engine*, QObject*, v8::Handlev8::Value, QHashedV8String const&, QQmlContextData, QV8QObjectWrapper::RevisionMode) /home/developer/bin/Qt/5.1.1/gcc/lib/libQt5Qml.so.5 0xb7bd38cd
    3 QV8QObjectWrapper::Getter(v8::Localv8::String, v8::AccessorInfo const&) /home/developer/bin/Qt/5.1.1/gcc/lib/libQt5Qml.so.5 0xb7bd3f0f
    4 ?? /home/developer/bin/Qt/5.1.1/gcc/lib/libQt5V8.so.5 0xb64017e8
    5 ?? /home/developer/bin/Qt/5.1.1/gcc/lib/libQt5V8.so.5 0xb6401f0a
    6 ?? /home/developer/bin/Qt/5.1.1/gcc/lib/libQt5V8.so.5 0xb638f66b
    7 ?? /home/developer/bin/Qt/5.1.1/gcc/lib/libQt5V8.so.5 0xb638f951
    8 ?? 0x4510a376
    9 ?? 0x50d0cb6f
    10 ?? 0x4510e341
    11 ?? 0x45121e52
    12 ?? 0x4511308a
    13 ?? /home/developer/bin/Qt/5.1.1/gcc/lib/libQt5V8.so.5 0xb6300a56
    14 ?? /home/developer/bin/Qt/5.1.1/gcc/lib/libQt5V8.so.5 0xb6302680
    15 ?? /home/developer/bin/Qt/5.1.1/gcc/lib/libQt5V8.so.5 0xb63027b9
    16 v8::Function::Call(v8::Handlev8::Object, int, v8::Handlev8::Value) /home/developer/bin/Qt/5.1.1/gcc/lib/libQt5V8.so.5 0xb62a6948
    17 ?? /home/developer/bin/Qt/5.1.1/gcc/lib/libQt5Qml.so.5 0xb7b4d2cd
    18 QQmlBoundSignalExpression::evaluate(void
    *) /home/developer/bin/Qt/5.1.1/gcc/lib/libQt5Qml.so.5 0xb7adec15
    19 ?? /home/developer/bin/Qt/5.1.1/gcc/lib/libQt5Qml.so.5 0xb7adfbbd
    20 QQmlNotifier::emitNotify(QQmlNotifierEndpoint*, void**) /home/developer/bin/Qt/5.1.1/gcc/lib/libQt5Qml.so.5 0xb7b2dfd5
    ... <More>

    Any ideas ? Or may be some problem of QtQuick parentness of the objects ...
    If need more info ask i will provide ...

  • I assume the Q_PROPERTY(SubClass sub...) was actually Q_PROPERTY(SubClass *sub...) as required for QObjects exposed to QML?

    The backtrace suggests that the crash actually occurs due to a bound signal handler (an onSomethingChanged function).

    Are you certain that it's the resolution of root.sub.listofsubobjects which is causing the crash? (If so, the backtrace suggests that it is identifying the QList<QObject*> as a QObject* ... which seems unlikely, as we do handle QList<QObject*> correctly in several different codepaths).

    Are you able to post a complete, minimal example which exhibits this bug?


Log in to reply

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