Review Request 120110: Fix a crash when shutting down plasma shell, while destruction models

David Edmundson david at davidedmundson.co.uk
Tue Sep 9 09:04:50 UTC 2014


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/120110/#review66098
-----------------------------------------------------------



src/declarativeimports/core/datasource.cpp
<https://git.reviewboard.kde.org/r/120110/#comment46134>

    Nice work identifying the cause, but I think we can improve the fix.
    
    We were calling this lambda after the datasource object is deleted so this (and therefore m_models) is pointing to random memory, we just happen to be resetting the random memory to zero just beforehand, but it's not a fix that is going to work for long.
    
    It's interesting that there's a model that outlives the datasource, that implies a buggy datasource somewhere... but we need to fix this too.
    
    It could be solved by using a normal slot so we get automatic disconnect wheh the receiver is destroyed. 
    
    Can probably be done with better lambdas but I don't know how.


- David Edmundson


On Sept. 9, 2014, 8:15 a.m., Joseph Wenninger wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/120110/
> -----------------------------------------------------------
> 
> (Updated Sept. 9, 2014, 8:15 a.m.)
> 
> 
> Review request for KDE Frameworks and Plasma.
> 
> 
> Repository: plasma-framework
> 
> 
> Description
> -------
> 
> Fix a crash when shutting down plasma shell, while destruction models
> 
> 
> While porting the kate session applet to plasma KF5, I noticed plasmashell crashing while using "kquitapp5 plasmashell" while destroying the model in the clipboard engine and in my engine (which is based on the clipboard engine). 
> 
> The problem for me was, that the lambda  in Plasma::DataEngine:167 accessed m_models, which was/is not valid anymore.
> 
> Thread 1 (Thread 0x7f2f4cadb880 (LWP 4241)):
> [KCrash Handler]
> #6  0x00007f2f488336df in QQmlOpenMetaObject::setValue(QByteArray const&, QVariant const&) () from /home/jowenn/KDE/qt5/qtbase/lib/libQt5Qml.so.5
> #7  0x00007f2f486c6d14 in QQmlPropertyMap::clear(QString const&) () from /home/jowenn/KDE/qt5/qtbase/lib/libQt5Qml.so.5
> #8  0x00007f2f2dfb94e4 in Plasma::DataSource::<lambda()>::operator()(void) const (__closure=0x7fffb8e86670) at /home/jowenn/KDE/kf5/src/frameworks/plasma-framework/src/declarativeimports/core/datasource.cpp:167
> #9  0x00007f2f2dfb9b88 in QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, Plasma::DataSource::modelChanged(const QString&, QAbstractItemModel*)::<lambda()> >::call(Plasma::DataSource::<lambda()>, void **) (f=..., arg=0x7fffb8e86800) at /home/jowenn/KDE/qt5/qtbase/src/corelib/kernel/qobjectdefs_impl.h:502
> #10 0x00007f2f2dfb9b5e in QtPrivate::Functor<Plasma::DataSource::modelChanged(const QString&, QAbstractItemModel*)::<lambda()>, 0>::call<QtPrivate::List<>, void>(Plasma::DataSource::<lambda()> &, void *, void **) (f=..., arg=0x7fffb8e86800) at /home/jowenn/KDE/qt5/qtbase/src/corelib/kernel/qobjectdefs_impl.h:559
> #11 0x00007f2f2dfb9b13 in QtPrivate::QFunctorSlotObject<Plasma::DataSource::modelChanged(const QString&, QAbstractItemModel*)::<lambda()>, 0, QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase *, QObject *, void **, bool *) (which=1, this_=0x56aee80, r=0x5776340, a=0x7fffb8e86800, ret=0x0) at /home/jowenn/KDE/qt5/qtbase/src/corelib/kernel/qobject_impl.h:200
> #12 0x00007f2f459656be in QMetaObject::activate(QObject*, int, int, void**) () from /home/jowenn/KDE/qt5/qtbase/lib/libQt5Core.so.5
> #13 0x00007f2f4596609f in QObject::destroyed(QObject*) () from /home/jowenn/KDE/qt5/qtbase/lib/libQt5Core.so.5
> #14 0x00007f2f4596d70b in QObject::~QObject() () from /home/jowenn/KDE/qt5/qtbase/lib/libQt5Core.so.5
> #15 0x00007f2f458ddd1d in QAbstractItemModel::~QAbstractItemModel() () from /home/jowenn/KDE/qt5/qtbase/lib/libQt5Core.so.5
> #16 0x00007f2e401af49e in KateSessionsModel::~KateSessionsModel (this=0x5776340, __in_chrg=<optimized out>) at /home/jowenn/KDE/kf5/src/kde/applications/kate/addons/sessionapplet/engine/katesessionsmodel.cpp:59
> #17 0x00007f2e401af4ce in KateSessionsModel::~KateSessionsModel (this=0x5776340, __in_chrg=<optimized out>) at /home/jowenn/KDE/kf5/src/kde/applications/kate/addons/sessionapplet/engine/katesessionsmodel.cpp:61
> #18 0x00007f2f4596460c in QObjectPrivate::deleteChildren() () from /home/jowenn/KDE/qt5/qtbase/lib/libQt5Core.so.5
> #19 0x00007f2f4596d493 in QObject::~QObject() () from /home/jowenn/KDE/qt5/qtbase/lib/libQt5Core.so.5
> #20 0x00007f2f4b644e47 in Plasma::DataContainer::~DataContainer (this=0x5775ef0, __in_chrg=<optimized out>) at /home/jowenn/KDE/kf5/src/frameworks/plasma-framework/src/plasma/datacontainer.cpp:37
> #21 0x00007f2f4b644e76 in Plasma::DataContainer::~DataContainer (this=0x5775ef0, __in_chrg=<optimized out>) at /home/jowenn/KDE/kf5/src/frameworks/plasma-framework/src/plasma/datacontainer.cpp:40
> #22 0x00007f2f4596460c in QObjectPrivate::deleteChildren() () from /home/jowenn/KDE/qt5/qtbase/lib/libQt5Core.so.5
> #23 0x00007f2f4596d493 in QObject::~QObject() () from /home/jowenn/KDE/qt5/qtbase/lib/libQt5Core.so.5
> #24 0x00007f2f4b648c21 in Plasma::DataEngine::~DataEngine (this=0x5774b50, __in_chrg=<optimized out>) at /home/jowenn/KDE/kf5/src/frameworks/plasma-framework/src/plasma/dataengine.cpp:76
> #25 0x00007f2e401ae418 in KateSessionsEngine::~KateSessionsEngine (this=0x5774b50, __in_chrg=<optimized out>) at /home/jowenn/KDE/kf5/src/kde/applications/kate/addons/sessionapplet/engine/katesessionsengine.cpp:36
> #26 0x00007f2e401ae448 in KateSessionsEngine::~KateSessionsEngine (this=0x5774b50, __in_chrg=<optimized out>) at /home/jowenn/KDE/kf5/src/kde/applications/kate/addons/sessionapplet/engine/katesessionsengine.cpp:38
> #27 0x00007f2f4b65133d in Plasma::DataEngineManager::unloadEngine (this=0x7f2f4b8dc7c0 <Plasma::(anonymous namespace)::Q_QGS_privateDataEngineManagerSelf::innerFunction()::holder>, name=...) at /home/jowenn/KDE/kf5/src/frameworks/plasma-framework/src/plasma/private/dataenginemanager.cpp:159
> #28 0x00007f2f4b64cc6d in Plasma::DataEngineConsumer::~DataEngineConsumer (this=0x552c070, __in_chrg=<optimized out>) at /home/jowenn/KDE/kf5/src/frameworks/plasma-framework/src/plasma/dataengineconsumer.cpp:85
> #29 0x00007f2f2dfa523a in Plasma::DataSource::~DataSource (this=0x552c060, __in_chrg=<optimized out>) at /home/jowenn/KDE/kf5/src/frameworks/plasma-framework/src/declarativeimports/core/datasource.h:43
> #30 0x00007f2f2dfac8b8 in QQmlPrivate::QQmlElement<Plasma::DataSource>::~QQmlElement (this=0x552c060, __in_chrg=<optimized out>) at /home/jowenn/KDE/qt5/qtdeclarative/src/qml/qml/qqmlprivate.h:106
> #31 0x00007f2f2dfac8e8 in QQmlPrivate::QQmlElement<Plasma::DataSource>::~QQmlElement (this=0x552c060, __in_chrg=<optimized out>) at /home/jowenn/KDE/qt5/qtdeclarative/src/qml/qml/qqmlprivate.h:106
> 
> 
> Diffs
> -----
> 
>   src/declarativeimports/core/datasource.h 3a8b522919f04f8581e98271aff55ccc001062c8 
>   src/declarativeimports/core/datasource.cpp 2e7a2af4919f85bb385e95f2a29f9cdb5e7ecfda 
> 
> Diff: https://git.reviewboard.kde.org/r/120110/diff/
> 
> 
> Testing
> -------
> 
> This part of plasma shell does not cause a crash for me anymore.
> 
> 
> Thanks,
> 
> Joseph Wenninger
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20140909/ce2cbae7/attachment.html>


More information about the Plasma-devel mailing list