rdit-ch / itemframework

A Qt-based application framework that allows users to define units and control the flow of data between them.
https://rdit.ch
8 stars 9 forks source link

ItemScene: nullptr segfault #35

Open t-moe opened 7 years ago

t-moe commented 7 years ago

bool ItemSerializer::loadFromXml (line 228 and following) calls extract* and does no check for nullptr in the connector or note case. This leads to a itemsOut list containing null items and segfaults later in the code.

t-moe commented 7 years ago

Example Stacktrace of a crash caused by this issue

1   QScopedPointer<QGraphicsItemPrivate, QScopedPointerDeleter<QGraphicsItemPrivate>>::operator->                                                                                                                              qscopedpointer.h               112  0x7ffff72b74f8 
2   QGraphicsItem::toGraphicsObject                                                                                                                                                                                            qgraphicsitem.cpp              1655 0x7ffff7298b82 
3   ItemScene::<lambda(QGraphicsItem *)>::operator()(QGraphicsItem *) const                                                                                                                                                    item_scene.cpp                 818  0x7ffff78c43c1 
4   std::for_each<QList<QGraphicsItem *>::iterator, ItemScene::loadFromXml(QDomElement&)::<lambda(QGraphicsItem *)>>(QList<QGraphicsItem *>::iterator, QList<QGraphicsItem *>::iterator, ItemScene::<lambda(QGraphicsItem *)>) stl_algo.h                     3769 0x7ffff78c4af8 
5   ItemScene::loadFromXml                                                                                                                                                                                                     item_scene.cpp                 827  0x7ffff78c4523 
6   ItemView::load                                                                                                                                                                                                             item_view.cpp                  52   0x7ffff78d0626 
7   ProjectGui::load                                                                                                                                                                                                           project_gui.cpp                249  0x7ffff790ac89 
8   AbstractWorkspaceGui::loadProject                                                                                                                                                                                          abstract_workspace_gui.cpp     96   0x7ffff790e7b4 
9   QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<QSharedPointer<ProjectGui>>, void, bool (AbstractWorkspaceGui:: *)(QSharedPointer<ProjectGui> const&)>::call                                             qobjectdefs_impl.h             501  0x7ffff7914efa 
10  QtPrivate::FunctionPointer<bool (AbstractWorkspaceGui:: *)(QSharedPointer<ProjectGui> const&)>::call<QtPrivate::List<QSharedPointer<ProjectGui>>, void>                                                                    qobjectdefs_impl.h             520  0x7ffff79148fd 
11  QtPrivate::QSlotObject<bool (AbstractWorkspaceGui:: *)(QSharedPointer<ProjectGui> const&), QtPrivate::List<QSharedPointer<ProjectGui>>, void>::impl                                                                        qobject_impl.h                 143  0x7ffff79139bb 
12  QtPrivate::QSlotObjectBase::call                                                                                                                                                                                           qobject_impl.h                 124  0x7ffff63055a9 
13  QMetaObject::activate                                                                                                                                                                                                      qobject.cpp                    3715 0x7ffff630245c 
14  QMetaObject::activate                                                                                                                                                                                                      qobject.cpp                    3595 0x7ffff6301d6e 
15  ProjectListDockWidget::loadProject                                                                                                                                                                                         moc_projectlist_dockwidget.cpp 194  0x7ffff794301b 
16  ProjectListDockWidget::listWidgetClicked                                                                                                                                                                                   projectlist_dockwidget.cpp     159  0x7ffff7925d20 
17  ProjectListDockWidget::qt_static_metacall                                                                                                                                                                                  moc_projectlist_dockwidget.cpp 106  0x7ffff7942c98 
18  QMetaObject::activate                                                                                                                                                                                                      qobject.cpp                    3730 0x7ffff6302567 
19  QMetaObject::activate                                                                                                                                                                                                      qobject.cpp                    3595 0x7ffff6301d6e 
20  QListWidget::itemDoubleClicked                                                                                                                                                                                             moc_qlistwidget.cpp            370  0x7ffff7258c05 
... <More>                                                                                                                                                                                                                                                                        
Shadowigor commented 7 years ago

I get that segfault as well, for example if you open a project that contains an item that you don't have installed/compiled.