Skip to content

Fix race: Object (m_item) is operated on before it is assigned.

The race happens in:

QObject *obj = component->create(ctx);
m_item = qobject_cast<QQuickItem *>(obj);

Truncated crash:

Thread 1 "krita" received signal SIGSEGV, Segmentation fault.                                                                                                                                 
0x00007ffff5546354 in QQmlContext::parentContext() const () from /usr/lib/libQt5Qml.so.5      
#0  0x00007ffff5546354 in QQmlContext::parentContext() const () at /usr/lib/libQt5Qml.so.5
#1  0x00007fff68362cf3 in DelegateRecycler::syncModelProperties() (this=0x55555d3a9210) at delegaterecycler.cpp:162
#2  0x00007fff68336367 in DelegateRecycler::qt_static_metacall() at moc_delegaterecycler.cpp:229
#3  0x00007fff683365bd in DelegateRecycler::qt_metacall() at moc_delegaterecycler.cpp:308

Merge request reports