Bug 391642

Summary: Plasma shell crashes when changing to desktop view
Product: [Plasma] plasmashell Reporter: Edward Kigwana <ekigwana>
Component: Desktop ContainmentAssignee: Sebastian Kügler <sebas>
Status: RESOLVED FIXED    
Severity: normal CC: albma, bugseforuns, christiandehne, daniel-other+kdebug, darkwingbuck13, kde, nate, notuxius, plasma-bugs, PTrenholme, rikmills, wazhai
Priority: NOR    
Version: master   
Target Milestone: 1.0   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In:

Description Edward Kigwana 2018-03-10 01:37:44 UTC
QT 5.10.1
Plasma 5.12.80 (master)

Plasma shell crashes when I right click to change desktop from folder view to desktop view. I have a dual monitor setup and a possibly unrelated issue is that when I click apply, the dialog on the right side jumps to the left monitor then plasma crashes. On the left it jumps to the right then plasma shell crashes. So there is some symmetry after a crash.

* 1    Thread 0x7ffff7f82800 (LWP 27909) "plasmashell" QJsonPrivate::Object::indexOf (this=0x5555559daa68, key=..., exists=exists@entry=0x7fffffffcf97) at json/qjson.cpp:184
  2    Thread 0x7fffe10f2700 (LWP 32332) "QXcbEventReader" 0x00007ffff129c3d5 in __GI___poll (fds=0x7fffe10f1ca8, nfds=1, timeout=<optimized out>) at ../sysdeps/unix/sysv/linux/poll.c:29
  3    Thread 0x7fffdb0f2700 (LWP 1624) "QDBusConnection" 0x00007ffff129c3d5 in __GI___poll (fds=0x7fffd4004db0, nfds=3, timeout=<optimized out>) at ../sysdeps/unix/sysv/linux/poll.c:29
  4    Thread 0x7fffd96ad700 (LWP 1748) "QQmlThread" 0x00007ffff129c3d5 in __GI___poll (fds=0x7fffcc004a00, nfds=1, timeout=<optimized out>) at ../sysdeps/unix/sysv/linux/poll.c:29
  5    Thread 0x7fffd219f700 (LWP 2126) "disk_cache:0" 0x00007ffff0b507cd in futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x555555ab4058) at ../sysdeps/unix/sysv/linux/futex-internal.h:88
  6    Thread 0x7fff4262e700 (LWP 3364) "QQuickPixmapRea" 0x00007ffff129c3d5 in __GI___poll (fds=0x7fff3c0057b0, nfds=1, timeout=<optimized out>) at ../sysdeps/unix/sysv/linux/poll.c:29
  7    Thread 0x7fff2f458700 (LWP 4001) "KCupsConnection" 0x00007ffff129c3d5 in __GI___poll (fds=0x7fff28006450, nfds=1, timeout=<optimized out>) at ../sysdeps/unix/sysv/linux/poll.c:29
  10   Thread 0x7fff19b46700 (LWP 17113) "QQmlThread" 0x00007ffff129c3d5 in __GI___poll (fds=0x7fff0c03c700, nfds=1, timeout=<optimized out>) at ../sysdeps/unix/sysv/linux/poll.c:29

#0  QJsonPrivate::Object::indexOf (this=0x5555559daa68, key=..., exists=exists@entry=0x7fffffffcf97) at json/qjson.cpp:184
#1  0x00007ffff1bc3de3 in QJsonObject::value (this=this@entry=0x7fffffffd140, key=...) at json/qjsonobject.cpp:393
#2  0x00007ffff3d114da in KPluginMetaData::readStringList (obj=..., key=...) at /var/tmp/portage/kde-frameworks/kcoreaddons-9999/work/kcoreaddons-9999/src/lib/plugin/kpluginmetadata.cpp:175
#3  0x00007ffff7995975 in PlasmaQuick::AppletQuickItemPrivate::preloadWeight (this=0x5555559d4d70) at /var/tmp/portage/kde-frameworks/plasma-9999/work/plasma-9999/src/plasmaquick/appletquickitem.cpp:94
#4  0x00007ffff7995e92 in PlasmaQuick::AppletQuickItem::~AppletQuickItem (this=0x5555559d5560, __in_chrg=<optimized out>) at /var/tmp/portage/kde-frameworks/plasma-9999/work/plasma-9999/src/plasmaquick/appletquickitem.cpp:509
#5  0x00007fffd3bda1eb in ContainmentInterface::~ContainmentInterface (this=0x5555559d5560, __in_chrg=<optimized out>) at /var/tmp/portage/kde-frameworks/plasma-9999/work/plasma-9999/src/scriptengines/qml/plasmoid/containmentinterface.h:51
#6  ContainmentInterface::~ContainmentInterface (this=0x5555559d5560, __in_chrg=<optimized out>) at /var/tmp/portage/kde-frameworks/plasma-9999/work/plasma-9999/src/scriptengines/qml/plasmoid/containmentinterface.h:51
#7  0x00007ffff1c1f4b0 in QObjectPrivate::deleteChildren (this=0x5555559bd650) at kernel/qobject.cpp:1993
#8  0x00007ffff1c2046e in QObject::~QObject (this=<optimized out>, __in_chrg=<optimized out>) at kernel/qobject.cpp:1023
#9  0x00007ffff5fb0e19 in Plasma::Containment::~Containment (this=0x5555559ce160, __in_chrg=<optimized out>) at /var/tmp/portage/kde-frameworks/plasma-9999/work/plasma-9999/src/plasma/containment.cpp:95
#10 0x00007ffff1c196d8 in QObject::event (this=0x5555559ce160, e=<optimized out>) at kernel/qobject.cpp:1238
#11 0x00007ffff2baa8dc in QApplicationPrivate::notify_helper (this=this@entry=0x555555811f50, receiver=receiver@entry=0x5555559ce160, e=e@entry=0x55555a325d00) at kernel/qapplication.cpp:3732
#12 0x00007ffff2bb2076 in QApplication::notify (this=0x7fffffffd970, receiver=0x5555559ce160, e=0x55555a325d00) at kernel/qapplication.cpp:3491
#13 0x00007ffff1be9a37 in QCoreApplication::notifyInternal2 (receiver=0x5555559ce160, event=event@entry=0x55555a325d00) at kernel/qcoreapplication.cpp:1050
#14 0x00007ffff1bed606 in QCoreApplication::sendEvent (event=0x55555a325d00, receiver=<optimized out>) at kernel/qcoreapplication.h:234
#15 QCoreApplicationPrivate::sendPostedEvents (receiver=receiver@entry=0x0, event_type=event_type@entry=0, data=0x5555558078e0) at kernel/qcoreapplication.cpp:1740
#16 0x00007ffff1bedb68 in QCoreApplication::sendPostedEvents (receiver=receiver@entry=0x0, event_type=event_type@entry=0) at kernel/qcoreapplication.cpp:1594
#17 0x00007ffff1c463f3 in postEventSourceDispatch (s=0x555555852e40) at kernel/qeventdispatcher_glib.cpp:276
#18 0x00007fffec084847 in g_main_context_dispatch () from /usr/lib64/libglib-2.0.so.0
#19 0x00007fffec084a78 in ?? () from /usr/lib64/libglib-2.0.so.0
#20 0x00007fffec084b0c in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0
#21 0x00007ffff1c45c5f in QEventDispatcherGlib::processEvents (this=0x555555853670, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#22 0x00007fffe2ebb691 in QPAEventDispatcherGlib::processEvents (this=0x555555853670, flags=...) at qeventdispatcher_glib.cpp:69
#23 0x00007ffff1be815b in QEventLoop::exec (this=this@entry=0x7fffffffd870, flags=..., flags@entry=...) at kernel/qeventloop.cpp:212
#24 0x00007ffff1bf1c64 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1338
#25 0x0000555555572a48 in main (argc=<optimized out>, argv=<optimized out>) at /var/tmp/portage/kde-plasma/plasma-workspace-9999/work/plasma-workspace-9999/shell/main.cpp:167
Comment 1 Patrick Silva 2018-03-12 12:46:25 UTC
crash reproducible on Arch Linux when I change desktop layout to desktop or folder.
plasma is not automatically restarted, I get a black screen and need to restart plasma manually.
Comment 2 Alexander Mentyu 2018-03-12 13:04:37 UTC
Looks related to https://bugs.kde.org/show_bug.cgi?id=390957
Comment 3 Rik Mills 2018-03-27 18:01:17 UTC
Also reported in: https://bugs.launchpad.net/bugs/1759328
Comment 4 Kai Uwe Broulik 2018-04-05 06:54:08 UTC
*** Bug 392746 has been marked as a duplicate of this bug. ***
Comment 5 Rik Mills 2018-04-07 21:51:45 UTC
So from thet duplicate, we can add that this occurs in:

Application: plasmashell (5.12.4)
Qt Version: 5.10.0
Frameworks Version: 5.44.0
Operating System: Linux 4.4.120-45-default x86_64
Distribution: "openSUSE Leap 42.3"
Comment 6 David Edmundson 2018-04-09 08:13:50 UTC
Writing the top backtrace out in words:

frame 9: containment(an applet subclass) gets deleted
frame 8: that deletes it's qobject children
frame 6: that deletes it's ContainmentInterface (the QML exposed containment side)
frame 3: that accesses the applet, which we delete in frame 9

Can do a simple QPointer guard, but that's just masking a more significant problem.


This crash shouldn't happen because:
Applet::~Applet should run between frames 9 and 8, AppletPrivate::~Private runs delete script, delete script *should* delete the ContainmentInterface.

So that means someone somewhere is calling containmentInterface->setParent(theContainment)
Find that and we find our crash.
Comment 7 David Edmundson 2018-04-09 08:33:38 UTC
src/plasmaquick/containmentview.cpp:             oldGraphicObject->setParent(containment);

exactly what I said it would be, and run when you switched from desktop to folder view
Will replace with something else
Comment 8 Kai Uwe Broulik 2018-04-09 17:23:11 UTC
*** Bug 392939 has been marked as a duplicate of this bug. ***
Comment 9 David Edmundson 2018-04-10 13:39:03 UTC
Git commit 2785916d01b26f5e9747bdf38428adce0a121842 by David Edmundson.
Committed on 10/04/2018 at 13:38.
Pushed by davidedmundson into branch 'master'.

Don't alter memory management to hide an item

Summary:
The original owner of a graphics item is the declarative applet script which
is owned and deleted by the applet.

Reparenting the containmentquickitem to the containment doesn't really
solve anything useful, we were originally effectively owned by the
containment(an applet subclass) not the view anyway.

This code also accidentally moves the destruction of the applet from being in
::~Applet to being in ::~QObject of the relevant containment. This
causes a big problem if the AppletQuickItem tries to access the applet
in it's own destructor. The applet object still exists, but use of
Applet member variables is not valid.

The new preloading code does this, leading to a crash.

Test Plan:
Changed desktop to folder twice
Changed activities twice

Reviewers: #plasma, mart

Reviewed By: #plasma, mart

Subscribers: rikmills, #frameworks

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D12064

M  +2    -5    src/plasmaquick/containmentview.cpp

https://commits.kde.org/plasma-framework/2785916d01b26f5e9747bdf38428adce0a121842
Comment 10 David Edmundson 2018-04-12 18:14:10 UTC
*** Bug 393041 has been marked as a duplicate of this bug. ***
Comment 11 David Edmundson 2018-05-15 11:58:56 UTC
*** Bug 393928 has been marked as a duplicate of this bug. ***
Comment 12 moshpirit 2020-02-19 12:58:01 UTC
This just happened to me on Manjaro 19.0.0
DE: KDE 5.66.0 / Plasma 5.17.5
Kernel: x86_64 Linux 5.5.2-1-MANJARO
Comment 13 Patrick Silva 2020-02-19 13:10:33 UTC
probably you are affected by bug 416260
Comment 14 Nate Graham 2020-03-06 18:20:00 UTC
*** Bug 416260 has been marked as a duplicate of this bug. ***
Comment 15 Nate Graham 2020-04-15 17:30:24 UTC
*** Bug 418359 has been marked as a duplicate of this bug. ***
Comment 16 Nate Graham 2021-01-08 20:34:35 UTC
After getting quite a few reports in rapid succession, we have not gotten any duplicates following a potential fix via code change. Is anyone still experiencing this? I am not.
Comment 17 Edward Kigwana 2021-01-08 21:16:42 UTC
Frameworks:  5.78.0
Plasmashell: 5.20.80
QT:          5.15.2

I don't have this issue anymore.
Comment 18 Nate Graham 2021-01-08 21:34:20 UTC
Phew, thanks!
Comment 19 Peter C. Trenholme 2021-01-09 01:54:33 UTC
No recent problem.