Qt 5.9 中的 QML 崩溃 - 帮助读取堆栈跟踪

QML crash in Qt 5.9 - help to read stack trace

我正在使用 Qt 5.9 编写一个应用程序,顶部是 C++ main 和 QML UI。一切正常(包括从 C++ 向 QML 发送信号)但是当我将 ChartView 添加到 UI 时,我看到了崩溃。 ChartView 的精简版本如下所示;当我从代码中省略它时,没有崩溃。

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

这是堆栈跟踪(来自优秀的 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)

任何人都可以在堆栈跟踪中找到一些可能导致崩溃的提示吗?

我能够 运行 使用折线图的 QML 示例,没有任何问题。

如果您要使用 Qt Charts,您必须将 QGuiApplication 更改为 QApplication 并将 QT += widgets 添加到 .pro