QML crash in Qt 5.9 - help to read stack trace

心已入冬 提交于 2020-07-15 08:17:22

问题


I am writing an app using Qt 5.9 with C++ main and QML UI on the top. Everything fine (including sending signals from C++ to QML) but when I add ChartView to the UI, I am seeing a crash. The stripped-down version of the ChartView looks like the following; when I omit it from the code, no crash.

ChartView {
    id: _chartView
    LineSeries {
        name: "avgZ"
        XYPoint { x: 0; y: 0}
    }
}

This is the stack trace (via excellent backward-cpp):

Stack trace (most recent call last):
#27   Object "", at 0xffffffffffffffff, in 
#26   Object "/home/eudoxos/pw/carxx/build/main-qt", at 0x561cceac54a9, in _start
#25   Source "/build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c", line 310, in __libc_start_main [0x7fafdf218b96]
#24   Object "/home/eudoxos/pw/carxx/build/main-qt", at 0x561cceac849b, in main
#23   Object "/usr/lib/x86_64-linux-gnu/libQt5Qml.so.5", at 0x7fafe297761c, in QQmlApplicationEngine::load(QUrl const&)
#22   Object "/usr/lib/x86_64-linux-gnu/libQt5Qml.so.5", at 0x7fafe29775dd, in QQmlApplicationEnginePrivate::startLoad(QUrl const&, QByteArray const&, bool)
#21   Object "/usr/lib/x86_64-linux-gnu/libQt5Qml.so.5", at 0x7fafe2977372, in QQmlApplicationEnginePrivate::finishLoad(QQmlComponent*)
#20   Object "/usr/lib/x86_64-linux-gnu/libQt5Qml.so.5", at 0x7fafe28f974e, in QQmlComponent::create(QQmlContext*)
#19   Object "/usr/lib/x86_64-linux-gnu/libQt5Qml.so.5", at 0x7fafe28fb407, in QQmlComponentPrivate::beginCreate(QQmlContextData*)
#18   Object "/usr/lib/x86_64-linux-gnu/libQt5Qml.so.5", at 0x7fafe2984c6b, in QQmlObjectCreator::create(int, QObject*, QQmlInstantiationInterrupt*)
#17   Object "/usr/lib/x86_64-linux-gnu/libQt5Qml.so.5", at 0x7fafe298197b, in QQmlObjectCreator::createInstance(int, QObject*, bool)
#16   Object "/usr/lib/x86_64-linux-gnu/libQt5Qml.so.5", at 0x7fafe2980ba5, in QQmlObjectCreator::populateInstance(int, QObject*, QObject*, QQmlPropertyData const*)
#15   Object "/usr/lib/x86_64-linux-gnu/libQt5Qml.so.5", at 0x7fafe2983e10, in QQmlObjectCreator::setupBindings(bool)
#14   Object "/usr/lib/x86_64-linux-gnu/libQt5Qml.so.5", at 0x7fafe29833d9, in QQmlObjectCreator::setPropertyBinding(QQmlPropertyData const*, QV4::CompiledData::Binding const*)
#13   Object "/usr/lib/x86_64-linux-gnu/libQt5Qml.so.5", at 0x7fafe2981145, in QQmlObjectCreator::createInstance(int, QObject*, bool)
#12   Object "/usr/lib/x86_64-linux-gnu/libQt5Qml.so.5", at 0x7fafe2910961, in QQmlType::create(QObject**, void**, unsigned long) const
#11   Object "/usr/lib/x86_64-linux-gnu/qt5/qml/QtCharts/libqtchartsqml2.so", at 0x7faf9632485a, in qt_plugin_instance
#10   Object "/usr/lib/x86_64-linux-gnu/qt5/qml/QtCharts/libqtchartsqml2.so", at 0x7faf963452a5, in QByteArray::reserve(int)
#9    Object "/usr/lib/x86_64-linux-gnu/libQt5Charts.so.5", at 0x7faf95ffc51e, in QtCharts::QChart::mapToPosition(QPointF const&, QtCharts::QAbstractSeries*)
#8    Object "/usr/lib/x86_64-linux-gnu/libQt5Charts.so.5", at 0x7faf95ff7975, in 
#7    Object "/usr/lib/x86_64-linux-gnu/libQt5Charts.so.5", at 0x7faf95ff683e, in 
#6    Object "/usr/lib/x86_64-linux-gnu/libQt5Charts.so.5", at 0x7faf95ff368c, in 
#5    Object "/usr/lib/x86_64-linux-gnu/libQt5Charts.so.5", at 0x7faf95ff2fe2, in 
#4    Object "/usr/lib/x86_64-linux-gnu/libQt5Charts.so.5", at 0x7faf9600045f, in QtCharts::QAbstractSeries::qt_metacall(QMetaObject::Call, int, void**)
#3    Object "/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5", at 0x7fafa2d85a5c, in QGraphicsTextItem::document() const
#2    Object "/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5", at 0x7fafa2d8571e, in non-virtual thunk to QGraphicsTextItem::focusOutEvent(QFocusEvent*)
#1    Object "/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5", at 0x7fafa2c7e311, in QWidgetTextControl::QWidgetTextControl(QObject*)
#0    Object "/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5", at 0x7fafa2c7e235, in QWidgetTextControl::setCursorWidth(int)
Segmentation fault (Address not mapped to object [(nil)])
Segmentation fault (core dumped)

Can anyone find some hint in the stack trace what could be causing the crash?

I was able to run QML examples with line charts without any issue.


回答1:


If you are going to use Qt Charts you must change the QGuiApplication to QApplication and add QT += widgets to .pro



来源:https://stackoverflow.com/questions/51532648/qml-crash-in-qt-5-9-help-to-read-stack-trace

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!