Bug 355672 - Clearing Recent Documents Causes Plasma Crash
Summary: Clearing Recent Documents Causes Plasma Crash
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Application Menu (Kicker) (show other bugs)
Version: 5.4.95
Platform: Arch Linux Linux
: NOR crash
Target Milestone: 1.0
Assignee: Eike Hein
URL:
Keywords:
: 355276 355722 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-11-21 05:24 UTC by Joe
Modified: 2015-12-01 15:02 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
And the attachment... (2.39 KB, patch)
2015-11-27 20:32 UTC, Ivan Čukić
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Joe 2015-11-21 05:24:08 UTC
Clearing Recent Documents in the menu causes all of plasma to crash/restart. I have also notice that it crash SystemSettings, too, when cleared from there (SystemSettings->Desktop Behaviour->Activities->Privacy->Select any of the clear options). Note, the SystemSettings crash only crashes itself - not all of Plasma. I can file a separate bug for that if needed.

I have also noticed that in 5.5, it appears that it no longer goes off of the contents of ~/.local/share/RecentDocuments.

(Most likely Useless) Stack Trace:

Application: Plasma (plasmashell), signal: Segmentation fault
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[Current thread is 1 (Thread 0x7f568d736800 (LWP 6006))]

Thread 10 (Thread 0x7f5675e76700 (LWP 6009)):
#0  0x00007f5686b3f18d in poll () from /usr/lib/libc.so.6
#1  0x00007f568bbf1ae2 in ?? () from /usr/lib/libxcb.so.1
#2  0x00007f568bbf3757 in xcb_wait_for_event () from /usr/lib/libxcb.so.1
#3  0x00007f5678000e89 in ?? () from /usr/lib/libQt5XcbQpa.so.5
#4  0x00007f568724a96e in ?? () from /usr/lib/libQt5Core.so.5
#5  0x00007f568633e4a4 in start_thread () from /usr/lib/libpthread.so.0
#6  0x00007f5686b4813d in clone () from /usr/lib/libc.so.6

Thread 9 (Thread 0x7f566eda6700 (LWP 6013)):
#0  0x00007ffd8adb9989 in ?? ()
#1  0x00007ffd8adb9cb5 in clock_gettime ()
#2  0x00007f5686b54d36 in clock_gettime () from /usr/lib/libc.so.6
#3  0x00007f56872fb036 in ?? () from /usr/lib/libQt5Core.so.5
#4  0x00007f568747fdf9 in QTimerInfoList::updateCurrentTime() () from /usr/lib/libQt5Core.so.5
#5  0x00007f5687480365 in QTimerInfoList::timerWait(timespec&) () from /usr/lib/libQt5Core.so.5
#6  0x00007f568748174e in ?? () from /usr/lib/libQt5Core.so.5
#7  0x00007f5682f8854d in g_main_context_prepare () from /usr/lib/libglib-2.0.so.0
#8  0x00007f5682f88eeb in ?? () from /usr/lib/libglib-2.0.so.0
#9  0x00007f5682f890cc in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#10 0x00007f568748236b in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
#11 0x00007f568742937a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
#12 0x00007f56872459c4 in QThread::exec() () from /usr/lib/libQt5Core.so.5
#13 0x00007f568a647c85 in ?? () from /usr/lib/libQt5Qml.so.5
#14 0x00007f568724a96e in ?? () from /usr/lib/libQt5Core.so.5
#15 0x00007f568633e4a4 in start_thread () from /usr/lib/libpthread.so.0
#16 0x00007f5686b4813d in clone () from /usr/lib/libc.so.6

Thread 8 (Thread 0x7f5663dee700 (LWP 6014)):
#0  0x00007f5686b3f18d in poll () from /usr/lib/libc.so.6
#1  0x00007f5682f88fbc in ?? () from /usr/lib/libglib-2.0.so.0
#2  0x00007f5682f890cc in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#3  0x00007f568748236b in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
#4  0x00007f568742937a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
#5  0x00007f56872459c4 in QThread::exec() () from /usr/lib/libQt5Core.so.5
#6  0x00007f568a647c85 in ?? () from /usr/lib/libQt5Qml.so.5
#7  0x00007f568724a96e in ?? () from /usr/lib/libQt5Core.so.5
#8  0x00007f568633e4a4 in start_thread () from /usr/lib/libpthread.so.0
#9  0x00007f5686b4813d in clone () from /usr/lib/libc.so.6

Thread 7 (Thread 0x7f5662126700 (LWP 6015)):
#0  0x00007f5682fcd5f9 in g_mutex_lock () from /usr/lib/libglib-2.0.so.0
#1  0x00007f5682f8886e in g_main_context_check () from /usr/lib/libglib-2.0.so.0
#2  0x00007f5682f88f60 in ?? () from /usr/lib/libglib-2.0.so.0
#3  0x00007f5682f890cc in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#4  0x00007f568748236b in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
#5  0x00007f568742937a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
#6  0x00007f56872459c4 in QThread::exec() () from /usr/lib/libQt5Core.so.5
#7  0x00007f568a647c85 in ?? () from /usr/lib/libQt5Qml.so.5
#8  0x00007f568724a96e in ?? () from /usr/lib/libQt5Core.so.5
#9  0x00007f568633e4a4 in start_thread () from /usr/lib/libpthread.so.0
#10 0x00007f5686b4813d in clone () from /usr/lib/libc.so.6

Thread 6 (Thread 0x7f565bfff700 (LWP 6016)):
#0  0x00007f568634407f in pthread_cond_wait@@GLIBC_2.3.2 () from /usr/lib/libpthread.so.0
#1  0x00007f568cec65e4 in ?? () from /usr/lib/libQt5Script.so.5
#2  0x00007f568cec6629 in ?? () from /usr/lib/libQt5Script.so.5
#3  0x00007f568633e4a4 in start_thread () from /usr/lib/libpthread.so.0
#4  0x00007f5686b4813d in clone () from /usr/lib/libc.so.6

Thread 5 (Thread 0x7f565a286700 (LWP 6017)):
#0  0x00007f568634407f in pthread_cond_wait@@GLIBC_2.3.2 () from /usr/lib/libpthread.so.0
#1  0x00007f568724bbfb in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/libQt5Core.so.5
#2  0x00007f568b28ca9e in ?? () from /usr/lib/libQt5Quick.so.5
#3  0x00007f568b28d323 in ?? () from /usr/lib/libQt5Quick.so.5
#4  0x00007f568724a96e in ?? () from /usr/lib/libQt5Core.so.5
#5  0x00007f568633e4a4 in start_thread () from /usr/lib/libpthread.so.0
#6  0x00007f5686b4813d in clone () from /usr/lib/libc.so.6

Thread 4 (Thread 0x7f55cbfc6700 (LWP 6018)):
#0  0x00007f568634407f in pthread_cond_wait@@GLIBC_2.3.2 () from /usr/lib/libpthread.so.0
#1  0x00007f568724bbfb in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/libQt5Core.so.5
#2  0x00007f568b28ca9e in ?? () from /usr/lib/libQt5Quick.so.5
#3  0x00007f568b28d323 in ?? () from /usr/lib/libQt5Quick.so.5
#4  0x00007f568724a96e in ?? () from /usr/lib/libQt5Core.so.5
#5  0x00007f568633e4a4 in start_thread () from /usr/lib/libpthread.so.0
#6  0x00007f5686b4813d in clone () from /usr/lib/libc.so.6

Thread 3 (Thread 0x7f55be6c6700 (LWP 6019)):
#0  0x00007f5682fcd5f9 in g_mutex_lock () from /usr/lib/libglib-2.0.so.0
#1  0x00007f5682f88b46 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#2  0x00007f5682f89020 in ?? () from /usr/lib/libglib-2.0.so.0
#3  0x00007f5682f890cc in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#4  0x00007f568748236b in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
#5  0x00007f568742937a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
#6  0x00007f56872459c4 in QThread::exec() () from /usr/lib/libQt5Core.so.5
#7  0x00007f55c8cd1bc7 in KCupsConnection::run() () from /usr/lib/libkcupslib.so
#8  0x00007f568724a96e in ?? () from /usr/lib/libQt5Core.so.5
#9  0x00007f568633e4a4 in start_thread () from /usr/lib/libpthread.so.0
#10 0x00007f5686b4813d in clone () from /usr/lib/libc.so.6

Thread 2 (Thread 0x7f55b35e6700 (LWP 6063)):
#0  0x00007f568634407f in pthread_cond_wait@@GLIBC_2.3.2 () from /usr/lib/libpthread.so.0
#1  0x00007f568724bbfb in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/libQt5Core.so.5
#2  0x00007f568b28ca9e in ?? () from /usr/lib/libQt5Quick.so.5
#3  0x00007f568b28d323 in ?? () from /usr/lib/libQt5Quick.so.5
#4  0x00007f568724a96e in ?? () from /usr/lib/libQt5Core.so.5
#5  0x00007f568633e4a4 in start_thread () from /usr/lib/libpthread.so.0
#6  0x00007f5686b4813d in clone () from /usr/lib/libc.so.6

Thread 1 (Thread 0x7f568d736800 (LWP 6006)):
[KCrash Handler]
#5  0x00007f56580e49a9 in KActivities::Experimental::Stats::Query::activities() const () from /usr/lib/libKF5ActivitiesExperimentalStats.so.1
#6  0x00007f5658109612 in KActivities::Experimental::Stats::forgetResources(KActivities::Experimental::Stats::Query const&) () from /usr/lib/libKF5ActivitiesExperimentalStats.so.1
#7  0x00007f56590f6196 in ?? () from /usr/lib/qt/qml/org/kde/plasma/private/kicker/libkickerplugin.so
#8  0x00007f56591035a8 in ?? () from /usr/lib/qt/qml/org/kde/plasma/private/kicker/libkickerplugin.so
#9  0x00007f568a605bd9 in ?? () from /usr/lib/libQt5Qml.so.5
#10 0x00007f568a583b8c in ?? () from /usr/lib/libQt5Qml.so.5
#11 0x00007f568a5853ac in ?? () from /usr/lib/libQt5Qml.so.5
#12 0x00007f568a585bbd in QV4::QObjectMethod::callInternal(QV4::CallData*) () from /usr/lib/libQt5Qml.so.5
#13 0x00007f568a59c723 in QV4::Runtime::callProperty(QV4::ExecutionEngine*, int, QV4::CallData*) () from /usr/lib/libQt5Qml.so.5
#14 0x00007f567fd3e2cc in ?? ()
#15 0x00007f56611272c8 in ?? ()
#16 0x00007f5661127268 in ?? ()
#17 0x0000000000000000 in ?? ()


Reproducible: Always

Steps to Reproduce:
1. Open Menu
2. Go to History Tab
3. Right Click on a document in the Recent Documents Section
4. Select either remove all or remove document
5. Plasma Crashes

Actual Results:  
Plasma Crashes with the above stack trace. Recent Documents are not cleared, either.

Expected Results:  
Plasma does not crash, and the documents are cleared.
Comment 1 Eike Hein 2015-11-21 16:52:14 UTC
Ivan, this is the crash I told you about.

[16:40] <Sho_> ivan|home, on master:
[16:40] <Sho_> ah fuck
[16:40] <Sho_> sec
[16:41] <Sho_> #6  0x00007f11c64f3f91 in
KActivities::Experimental::Stats::Query::activities (this=0x38) at
/home/sho/devel/src/kde/workspace/plasma-desktop/lib/kactivities-stats/src/lib/stats/query.cpp:140
[16:41] <Sho_> #7  0x00007f11c6511dc7 in
KActivities::Experimental::Stats::forgetResources (query=...) at
/home/sho/devel/src/kde/workspace/plasma-desktop/lib/kactivities-stats/src/lib/stats/cleaning.cpp:47
[16:41] <Sho_> #8  0x00007f11c650628a in
KActivities::Experimental::Stats::ResultModel::forgetAllResources
(this=0x405f420) at
/home/sho/devel/src/kde/workspace/plasma-desktop/lib/kactivities-stats/src/lib/stats/resultmodel.cpp:794
[16:41] <Sho_> ivan|home: reproducable crash on forgetall on master ^
Comment 2 David Edmundson 2015-11-24 18:09:56 UTC
See also https://bugs.kde.org/show_bug.cgi?id=355722

it's subtly different 
forgetResource not forgetResource*s*
Comment 3 Kai Uwe Broulik 2015-11-25 22:19:32 UTC
I'm getting this backtrace when I clear history:

#6  0x00007f14cc5f0b7a in QListData::size() const () from /usr/lib/x86_64-linux-gnu/libKF5ActivitiesExperimentalStats.so.1
#7  0x00007f14cc608298 in QList<KActivities::Experimental::Stats::ResultSet::Result>::size() const () from /usr/lib/x86_64-linux-gnu/libKF5ActivitiesExperimentalStats.so.1
#8  0x00007f14cc603f34 in KActivities::Experimental::Stats::ResultModelPrivate::Cache::size() const () from /usr/lib/x86_64-linux-gnu/libKF5ActivitiesExperimentalStats.so.1
#9  0x00007f14cc6031f0 in KActivities::Experimental::Stats::ResultModel::forgetResource(int) () from /usr/lib/x86_64-linux-gnu/libKF5ActivitiesExperimentalStats.so.1
#10 0x00007f14cc8c889a in RecentUsageModel::trigger(int, QString const&, QVariant const&) () from /usr/lib/x86_64-linux-gnu/qt5/qml/org/kde/plasma/private/kicker/libkickerplugin.so
Comment 4 Ivan Čukić 2015-11-27 20:31:46 UTC
I finally reproduced this, though in Kickoff, not in Kicker.

Is this happening for Kicker as well?

If the main problem is Kickoff, like it is for me, the issue might be that the model sometimes thinks sourceModel is KAStats::ResultModel and sometimes GroupSortProxy:

recentusagemodel.cpp: static_cast<GroupSortProxy *>(sourceModel());
recentusagemodel.cpp: static_cast<ResultModel *>(sourceModel());

The patch in the attachment fixes the crash I have in Kickoff.
Comment 5 Ivan Čukić 2015-11-27 20:32:15 UTC
Created attachment 95778 [details]
And the attachment...
Comment 6 David Edmundson 2015-11-27 20:38:10 UTC
Looks like a likely cuase.

Can you replace the static casts with qobject casts. 
Had the original code used them we would have narrowed this bug down immediately.
Comment 7 Ivan Čukić 2015-11-27 20:49:04 UTC
I don't want to step on Eike's toes - the cleanest solution would be probably to keep a non-null ResultModel* member in the model (and GroupSortProxy* which could be null) so that no casts are required, but I didn't want to taint the .h file.

> Had the original code used them we would have narrowed this bug down immediately.

The problem is that at the same time a similar crash in KActivities KCM appeared. Though, that seems to have been clang-format changing my dbus paths :)
Comment 8 Ivan Čukić 2015-11-27 20:52:02 UTC
*** Bug 355276 has been marked as a duplicate of this bug. ***
Comment 9 Ivan Čukić 2015-11-30 20:04:17 UTC
*** Bug 355722 has been marked as a duplicate of this bug. ***
Comment 10 Eike Hein 2015-11-30 21:36:33 UTC
Ivan, feel free to commit this to the 5.5 branch and thanks for working it up. I'm happy with the static_cast variant for this myself, but I don't object to the other proposals either if they make folks feel better (I prefer to avoid member clutter though).
Comment 11 Ivan Čukić 2015-12-01 15:01:14 UTC
Git commit 3c1c89866f0301698097e48c7da3cf6b2978acbd by Ivan Čukić.
Committed on 01/12/2015 at 15:01.
Pushed by ivan into branch 'master'.

Kickoff thought that its source model is KAStats::ResultModel. It was mistaken.

M  +17   -4    applets/kicker/plugin/recentusagemodel.cpp
M  +2    -0    applets/kicker/plugin/recentusagemodel.h

http://commits.kde.org/plasma-desktop/3c1c89866f0301698097e48c7da3cf6b2978acbd
Comment 12 Ivan Čukić 2015-12-01 15:02:56 UTC
Git commit d6083260831ab21591dea751cb41f0390ccbf251 by Ivan Čukić.
Committed on 01/12/2015 at 15:02.
Pushed by ivan into branch 'Plasma/5.5'.

Kickoff thought that its source model is KAStats::ResultModel. It was mistaken.

M  +17   -4    applets/kicker/plugin/recentusagemodel.cpp
M  +2    -0    applets/kicker/plugin/recentusagemodel.h

http://commits.kde.org/plasma-desktop/d6083260831ab21591dea751cb41f0390ccbf251