Bug 477165

Summary: When restarted while running under systemd, plasmashell crashes in qDeleteAll<QList<CalendarEvents::CalendarEventsPlugin*>::const_iterator>
Product: [Plasma] plasmashell Reporter: Nate Graham <nate>
Component: Digital ClockAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED FIXED    
Severity: crash CC: jcruz, mooodyhunter, nicolas.fella, nicolas, qydwhotmail
Priority: NOR Keywords: qt6
Version: master   
Target Milestone: 1.0   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 6.0.3
Sentry Crash Report:

Description Nate Graham 2023-11-17 22:42:05 UTC
100% reproducible for me with Plasma 6 Wayland from today's git master. Started happening 2 or 3 days ago every time I restart plasmashell using either `systemctl restart --user plasma-plasmashell.service` or `plasmashell --replace`.

Of note, if plasmahell is *not* run under systemd, then `plasmashell --replace` does not cause the crash.

Backtrace:

Thread 1 "plasmashell" received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()
(gdb) bt
#0  0x0000000000000000 in  ()
#1  0x00007fd33de94f0e in qDeleteAll<QList<CalendarEvents::CalendarEventsPlugin*>::const_iterator>(QList<CalendarEvents::CalendarEventsPlugin*>::const_iterator, QList<CalendarEvents::CalendarEventsPlugin*>::const_iterator) (end=..., begin=...) at /usr/include/qt6/QtCore/qalgorithms.h:27
#2  qDeleteAll<QList<CalendarEvents::CalendarEventsPlugin*> >(QList<CalendarEvents::CalendarEventsPlugin*> const&) (c=...) at /usr/include/qt6/QtCore/qalgorithms.h:35
#3  EventPluginsManagerPrivate::~EventPluginsManagerPrivate()
    (this=0x4be24f0, __in_chrg=<optimized out>)
    at /home/nate/kde/src/plasma-workspace/components/calendar/eventpluginsmanager.cpp:183
#4  0x00007fd33de95010 in EventPluginsManager::~EventPluginsManager()
    (this=0x4be26c0, __in_chrg=<optimized out>)
    at /home/nate/kde/src/plasma-workspace/components/calendar/eventpluginsmanager.cpp:194
#5  0x00007fd33de84d3b in QQmlPrivate::QQmlElement<EventPluginsManager>::~QQmlElement()
    (this=0x4be26c0, __in_chrg=<optimized out>) at /usr/include/qt6/QtQml/qqmlprivate.h:99
#6  QQmlPrivate::QQmlElement<EventPluginsManager>::~QQmlElement()
    (this=0x4be26c0, __in_chrg=<optimized out>) at /usr/include/qt6/QtQml/qqmlprivate.h:99
#7  0x00007fd3f29fa71d in QObjectPrivate::deleteChildren() () at /lib64/libQt6Core.so.6
#8  0x00007fd3f29fed58 in QObject::~QObject() () at /lib64/libQt6Core.so.6
#9  0x00007fd3f54428db in QQuickItem::~QQuickItem() (this=<optimized out>, __in_chrg=<optimized out>)
    at /usr/src/debug/qt6-qtdeclarative-6.6.0-1.fc39.x86_64/src/quick/items/qquickitem.cpp:2364
#10 0x00007fd3dbd0cc3d in QQuickContentItem::~QQuickContentItem()
    (this=0x4be04f0, __in_chrg=<optimized out>)
    at /usr/src/debug/qt6-qtdeclarative-6.6.0-1.fc39.x86_64/src/quicktemplates/qquickcontentitem_p.h:23
#11 QQuickContentItem::~QQuickContentItem() (this=0x4be04f0, __in_chrg=<optimized out>)
    at /usr/src/debug/qt6-qtdeclarative-6.6.0-1.fc39.x86_64/src/quicktemplates/qquickcontentitem_p.h:23
#12 0x00007fd3f29fa71d in QObjectPrivate::deleteChildren() () at /lib64/libQt6Core.so.6
#13 0x00007fd3f29fed58 in QObject::~QObject() () at /lib64/libQt6Core.so.6
#14 0x00007fd3f54428db in QQuickItem::~QQuickItem() (this=<optimized out>, __in_chrg=<optimized out>)
    at /usr/src/debug/qt6-qtdeclarative-6.6.0-1.fc39.x86_64/src/quick/items/qquickitem.cpp:2364
#15 0x00007fd3dbd1279c in QQuickControl::~QQuickControl()
    (this=<optimized out>, __in_chrg=<optimized out>)
    at /usr/src/debug/qt6-qtdeclarative-6.6.0-1.fc39.x86_64/src/quicktemplates/qquickcontrol.cpp:948
#16 0x00007fd3dbd4ca90 in QQuickPane::~QQuickPane() (this=<optimized out>, __in_chrg=<optimized out>)
    at /usr/src/debug/qt6-qtdeclarative-6.6.0-1.fc39.x86_64/src/quicktemplates/qquickpane.cpp:242
#17 0x00007fd3dbd4994c in QQuickPage::~QQuickPage() (this=<optimized out>, __in_chrg=<optimized out>)
    at /usr/src/debug/qt6-qtdeclarative-6.6.0-1.fc39.x86_64/src/quicktemplates/qquickpage.cpp:217
#18 0x00007fd3dbdbc901 in QQmlPrivate::QQmlElement<QQuickPage>::~QQmlElement()
    (this=0x4b26830, __in_chrg=<optimized out>)
    at /usr/src/debug/qt6-qtdeclarative-6.6.0-1.fc39.x86_64/src/qml/qml/qqmlprivate.h:99
#19 QQmlPrivate::QQmlElement<QQuickPage>::~QQmlElement() (this=0x4b26830, __in_chrg=<optimized out>)
    at /usr/src/debug/qt6-qtdeclarative-6.6.0-1.fc39.x86_64/src/qml/qml/qqmlprivate.h:99
#20 0x00007fd3f61ad8e2 in PlasmaQuick::AppletQuickItem::~AppletQuickItem()
    (this=0x3972c40, __in_chrg=<optimized out>)
    at /home/nate/kde/src/plasma-framework/src/plasmaquick/appletquickitem.cpp:463
#21 0x00007fd3f61b0f35 in QQmlPrivate::QQmlElement<PlasmoidItem>::~QQmlElement()
    (this=0x3972c40, __in_chrg=<optimized out>) at /usr/include/qt6/QtQml/qqmlprivate.h:99
#22 QQmlPrivate::QQmlElement<PlasmoidItem>::~QQmlElement() (this=0x3972c40, __in_chrg=<optimized out>)
    at /usr/include/qt6/QtQml/qqmlprivate.h:99
#23 0x00007fd3f61ab045 in operator() (__closure=<optimized out>, applet=<optimized out>)
    at /home/nate/kde/src/plasma-framework/src/plasmaquick/appletquickitem.cpp:594
#24 QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<Plasma::Applet*>, void, PlasmaQuick::AppletQuickItem::itemForApplet(Plasma::Applet*)::<lambda(Plasma::Applet*)> >::call
    (arg=<optimized out>, f=<optimized out>) at /usr/include/qt6/QtCore/qobjectdefs_impl.h:137
#25 QtPrivate::Functor<PlasmaQuick::AppletQuickItem::itemForApplet(Plasma::Applet*)::<lambda(Plasma::Applet*)>, 1>::call<QtPrivate::List<Plasma::Applet*>, void> (arg=<optimized out>, f=<optimized out>)
    at /usr/include/qt6/QtCore/qobjectdefs_impl.h:339
#26 QtPrivate::QCallableObject<PlasmaQuick::AppletQuickItem::itemForApplet(Plasma::Applet*)::<lambda(Plasma::Applet*)>, QtPrivate::List<Plasma::Applet*>, void>::impl(int, QtPrivate::QSlotObjectBase *, QObject *, void **, bool *)
    (which=<optimized out>, this_=<optimized out>, r=<optimized out>, a=<optimized out>, ret=<optimized out>) at /usr/include/qt6/QtCore/qobjectdefs_impl.h:522
#27 0x00007fd3f2a02011 in void doActivate<false>(QObject*, int, void**) () at /lib64/libQt6Core.so.6
#28 0x00007fd3f5db6702 in Plasma::Applet::appletDeleted(Plasma::Applet*)
    (this=this@entry=0x1dfe410, _t1=<optimized out>, _t1@entry=0x1dfe410)
    at /home/nate/kde/build6/plasma-framework/src/plasma/KF6Plasma_autogen/include/moc_applet.cpp:1235
#29 0x00007fd3f5db8760 in Plasma::Applet::~Applet() (this=0x1dfe410, __in_chrg=<optimized out>)
    at /home/nate/kde/src/plasma-framework/src/plasma/applet.cpp:81
#30 0x00007fd3f5db87e9 in Plasma::Applet::~Applet() (this=0x1dfe410, __in_chrg=<optimized out>)
    at /home/nate/kde/src/plasma-framework/src/plasma/applet.cpp:90
#31 0x00007fd3f29fa71d in QObjectPrivate::deleteChildren() () at /lib64/libQt6Core.so.6
#32 0x00007fd3f29fed58 in QObject::~QObject() () at /lib64/libQt6Core.so.6
#33 0x00007fd3f5dbfaf9 in Plasma::Containment::~Containment()
    (this=0x1cfd2c0, __in_chrg=<optimized out>)
    at /home/nate/kde/src/plasma-framework/src/plasma/containment.cpp:66
#34 0x0000000000463431 in ShellCorona::~ShellCorona() (this=0x19f28e0, __in_chrg=<optimized out>)
    at /home/nate/kde/src/plasma-workspace/shell/shellcorona.cpp:314
#35 0x0000000000463859 in ShellCorona::~ShellCorona() (this=0x19f28e0, __in_chrg=<optimized out>)
    at /home/nate/kde/src/plasma-workspace/shell/shellcorona.cpp:316
#36 0x00007fd3f29f3419 in QObject::event(QEvent*) () at /lib64/libQt6Core.so.6
#37 0x00007fd3f3fc2b38 in QApplicationPrivate::notify_helper(QObject*, QEvent*) ()
    at /lib64/libQt6Widgets.so.6
#38 0x00007fd3f29a0ba8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) ()
    at /lib64/libQt6Core.so.6
#39 0x00007fd3f29a4aa5 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) ()
    at /lib64/libQt6Core.so.6
#40 0x00007fd3f29a97da in QCoreApplication::exec() () at /lib64/libQt6Core.so.6
#41 0x0000000000425f3a in main(int, char**) (argc=<optimized out>, argv=<optimized out>)
    at /home/nate/kde/src/plasma-workspace/shell/main.cpp:230
Comment 1 Bug Janitor Service 2023-11-20 13:30:55 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/3570
Comment 2 Nate Graham 2024-01-29 15:35:51 UTC
FWIW this has stopped happening. I guess something else fixed it.
Comment 3 Nicolas Fella 2024-02-20 08:23:31 UTC
*** Bug 481558 has been marked as a duplicate of this bug. ***
Comment 4 Harald Sitter 2024-02-22 06:25:37 UTC
*** Bug 481639 has been marked as a duplicate of this bug. ***
Comment 5 Harald Sitter 2024-02-22 06:37:45 UTC
Git commit 0f1fe59a2e413b82609b2aac4cf47d9345882cae by Harald Sitter.
Committed on 22/02/2024 at 06:25.
Pushed by sitter into branch 'master'.

eventpluginsmanager: don't crash on double-delete of plugin objects

The Qt docs command no deletes!

> Don't try to delete the root component. Instead rely on that unload()
will automatically delete it when needed.

and

> When the library is finally unloaded, the root component will
automatically be deleted.

consequently don't delete the root component and then crash when a
double delete occurs. This notably seems easy to produce with multiple
clocks that have events plugins loaded.

M  +3    -1    components/calendar/eventpluginsmanager.cpp

https://invent.kde.org/plasma/plasma-workspace/-/commit/0f1fe59a2e413b82609b2aac4cf47d9345882cae
Comment 6 Fushan Wen 2024-03-23 12:54:31 UTC
*** Bug 483435 has been marked as a duplicate of this bug. ***
Comment 7 Fushan Wen 2024-03-23 13:06:09 UTC
Git commit 51239aa1033b6deeff0e382e43d4abaf9411a756 by Fushan Wen, on behalf of Harald Sitter.
Committed on 23/03/2024 at 12:53.
Pushed by fusionfuture into branch 'Plasma/6.0'.

eventpluginsmanager: don't crash on double-delete of plugin objects

The Qt docs command no deletes!

> Don't try to delete the root component. Instead rely on that unload()
will automatically delete it when needed.

and

> When the library is finally unloaded, the root component will
automatically be deleted.

consequently don't delete the root component and then crash when a
double delete occurs. This notably seems easy to produce with multiple
clocks that have events plugins loaded.


(cherry picked from commit 0f1fe59a2e413b82609b2aac4cf47d9345882cae)

M  +3    -1    components/calendar/eventpluginsmanager.cpp

https://invent.kde.org/plasma/plasma-workspace/-/commit/51239aa1033b6deeff0e382e43d4abaf9411a756