Bug 490372

Summary: Plasmashell crashing pretty frequently in PlasmaTheme::~PlasmaTheme()
Product: [Plasma] plasmashell Reporter: Steve Cossette <farchord>
Component: generic-crashAssignee: Plasma Bugs List <plasma-bugs-null>
Status: RESOLVED WORKSFORME    
Severity: crash CC: akselmo, bugseforuns, julien.dlq, kdedev, nate, news.group, nicolas.fella, notmart, ozonehelix, pollux66
Priority: NOR Keywords: drkonqi
Version First Reported In: 6.1.2   
Target Milestone: 1.0   
Platform: Fedora RPMs   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=487102
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: New crash information added by DrKonqi
plasma-org.kde.plasma.desktop-appletsrc

Description Steve Cossette 2024-07-16 19:49:32 UTC
Application: plasmashell (6.1.2)

Qt Version: 6.7.2
Frameworks Version: 6.3.0
Operating System: Linux 6.9.7-200.fc40.x86_64 x86_64
Windowing System: Wayland
Distribution: "Fedora release 40 (Forty)"
DrKonqi: 6.1.2 [CoredumpBackend]

-- Information about the crash:
Honestly, Plasmashell crashes rather randomly. My auto-hide panel also sometimes refuses to show anymore after a resume. This time, it crashed when I tried to start Spotify, but.... it's honestly very random

The reporter is unsure if this crash is reproducible.

-- Backtrace (Reduced):
#5  std::__atomic_base<int>::fetch_sub (this=0x8addae7f50, __i=1, __m=std::memory_order::acq_rel, this=<optimized out>, __i=<optimized out>, __m=<optimized out>) at /usr/include/c++/14/bits/atomic_base.h:639
#6  QAtomicOps<int>::deref<int> (_q_value=<error reading variable: Cannot access memory at address 0x8addae7f50>, _q_value=<optimized out>) at /usr/include/qt6/QtCore/qatomic_cxx11.h:266
[...]
#8  Plasma::Theme::~Theme (this=this@entry=0x558ae3b02058, this=<optimized out>) at /usr/src/debug/libplasma-6.1.2-1.fc40.x86_64/src/plasma/theme.cpp:85
#9  0x00007efc0ea0fa74 in PlasmaTheme::~PlasmaTheme (this=0x558ae3b02040, this=<optimized out>) at /usr/src/debug/libplasma-6.1.2-1.fc40.x86_64/src/declarativeimports/kirigamiplasmastyle/plasmatheme.cpp:59
#10 PlasmaTheme::~PlasmaTheme (this=0x558ae3b02040, this=<optimized out>) at /usr/src/debug/libplasma-6.1.2-1.fc40.x86_64/src/declarativeimports/kirigamiplasmastyle/plasmatheme.cpp:59


Reported using DrKonqi
Comment 1 Steve Cossette 2024-07-16 19:49:34 UTC
Created attachment 171712 [details]
New crash information added by DrKonqi

DrKonqi auto-attaching complete backtrace.
Comment 2 Akseli Lahtinen 2024-07-18 08:11:02 UTC
In kde/src/libplasma/src/plasma/theme.cpp

```cpp

    } else {
        if (!d->ref.deref()) {
            delete ThemePrivate::themes.take(d->themeName);
        }
    }
```
I think that `d` doesnt exist and it segfaults at times. Should probably be guarded?
Comment 3 Akseli Lahtinen 2024-07-18 08:12:54 UTC
Searchable backtrace

Thread 1 (Thread 0x7efc2b61ab00 (LWP 4872)):
[KCrash Handler]
#5  std::__atomic_base<int>::fetch_sub (this=0x8addae7f50, __i=1, __m=std::memory_order::acq_rel, this=<optimized out>, __i=<optimized out>, __m=<optimized out>) at /usr/include/c++/14/bits/atomic_base.h:639
#6  QAtomicOps<int>::deref<int> (_q_value=<error reading variable: Cannot access memory at address 0x8addae7f50>, _q_value=<optimized out>) at /usr/include/qt6/QtCore/qatomic_cxx11.h:266
#7  QBasicAtomicInteger<int>::deref (this=0x8addae7f50, this=<optimized out>) at /usr/include/qt6/QtCore/qbasicatomic.h:48
#8  Plasma::Theme::~Theme (this=this@entry=0x558ae3b02058, this=<optimized out>) at /usr/src/debug/libplasma-6.1.2-1.fc40.x86_64/src/plasma/theme.cpp:85
#9  0x00007efc0ea0fa74 in PlasmaTheme::~PlasmaTheme (this=0x558ae3b02040, this=<optimized out>) at /usr/src/debug/libplasma-6.1.2-1.fc40.x86_64/src/declarativeimports/kirigamiplasmastyle/plasmatheme.cpp:59
#10 PlasmaTheme::~PlasmaTheme (this=0x558ae3b02040, this=<optimized out>) at /usr/src/debug/libplasma-6.1.2-1.fc40.x86_64/src/declarativeimports/kirigamiplasmastyle/plasmatheme.cpp:59
#11 0x00007efc319f40dd in QObjectPrivate::deleteChildren (this=this@entry=0x558ae169aa00) at /usr/src/debug/qt6-qtbase-6.7.2-3.fc40.x86_64/src/corelib/kernel/qobject.cpp:2222
#12 0x00007efc319f94d4 in QObject::~QObject (this=this@entry=0x558ae53883a0, __in_chrg=<optimized out>) at /usr/src/debug/qt6-qtbase-6.7.2-3.fc40.x86_64/src/corelib/kernel/qobject.cpp:1172
#13 0x00007efc33408a53 in QQuickItem::~QQuickItem (this=this@entry=0x558ae53883a0, __in_chrg=<optimized out>) at /usr/src/debug/qt6-qtdeclarative-6.7.2-1.fc40.x86_64/src/quick/items/qquickitem.cpp:2426
#14 0x00007efc0f5d314e in KSvg::FrameSvgItem::~FrameSvgItem (this=this@entry=0x558ae53883a0, this=<optimized out>) at /usr/src/debug/kf6-ksvg-6.3.0-2.fc40.x86_64/src/declarativeimports/framesvgitem.cpp:300
#15 0x00007efc0f5d3261 in QQmlPrivate::QQmlElement<KSvg::FrameSvgItem>::~QQmlElement (this=0x558ae53883a0, this=<optimized out>) at /usr/include/qt6/QtQml/qqmlprivate.h:100
#16 QQmlPrivate::QQmlElement<KSvg::FrameSvgItem>::~QQmlElement (this=0x558ae53883a0, this=<optimized out>) at /usr/include/qt6/QtQml/qqmlprivate.h:100
#17 0x00007efc319f40dd in QObjectPrivate::deleteChildren (this=this@entry=0x558ae52d6bd0) at /usr/src/debug/qt6-qtbase-6.7.2-3.fc40.x86_64/src/corelib/kernel/qobject.cpp:2222
#18 0x00007efc319f94d4 in QObject::~QObject (this=this@entry=0x558ae4e74140, __in_chrg=<optimized out>) at /usr/src/debug/qt6-qtbase-6.7.2-3.fc40.x86_64/src/corelib/kernel/qobject.cpp:1172
#19 0x00007efc33408a53 in QQuickItem::~QQuickItem (this=this@entry=0x558ae4e74140, __in_chrg=<optimized out>) at /usr/src/debug/qt6-qtdeclarative-6.7.2-1.fc40.x86_64/src/quick/items/qquickitem.cpp:2426
#20 0x00007efc33664151 in QQmlPrivate::QQmlElement<QQuickItem>::~QQmlElement (this=0x558ae4e74140, __in_chrg=<optimized out>) at /usr/src/debug/qt6-qtdeclarative-6.7.2-1.fc40.x86_64/src/qml/qml/qqmlprivate.h:100
#21 QQmlPrivate::QQmlElement<QQuickItem>::~QQmlElement (this=0x558ae4e74140, __in_chrg=<optimized out>) at /usr/src/debug/qt6-qtdeclarative-6.7.2-1.fc40.x86_64/src/qml/qml/qqmlprivate.h:100
#22 0x00007efc319edb59 in QObject::event (this=0x558ae4e74140, e=0x558addcdfee0) at /usr/src/debug/qt6-qtbase-6.7.2-3.fc40.x86_64/src/corelib/kernel/qobject.cpp:1437
#23 0x00007efc33d8b218 in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0x558ae4e74140, e=0x558addcdfee0) at /usr/src/debug/qt6-qtbase-6.7.2-3.fc40.x86_64/src/widgets/kernel/qapplication.cpp:3287
#24 0x00007efc31996dc8 in QCoreApplication::notifyInternal2 (receiver=0x558ae4e74140, event=0x558addcdfee0) at /usr/src/debug/qt6-qtbase-6.7.2-3.fc40.x86_64/src/corelib/kernel/qcoreapplication.cpp:1142
#25 0x00007efc3199702d in QCoreApplication::sendEvent (receiver=<optimized out>, event=<optimized out>) at /usr/src/debug/qt6-qtbase-6.7.2-3.fc40.x86_64/src/corelib/kernel/qcoreapplication.cpp:1583
#26 0x00007efc3199ab91 in QCoreApplicationPrivate::sendPostedEvents (receiver=0x0, event_type=0, data=0x558add4d2ba0) at /usr/src/debug/qt6-qtbase-6.7.2-3.fc40.x86_64/src/corelib/kernel/qcoreapplication.cpp:1940
#27 0x00007efc3199ae3d in QCoreApplication::sendPostedEvents (receiver=<optimized out>, event_type=<optimized out>) at /usr/src/debug/qt6-qtbase-6.7.2-3.fc40.x86_64/src/corelib/kernel/qcoreapplication.cpp:1797
#28 0x00007efc31c858ef in postEventSourceDispatch (s=0x558add500b00) at /usr/src/debug/qt6-qtbase-6.7.2-3.fc40.x86_64/src/corelib/kernel/qeventdispatcher_glib.cpp:244
#29 0x00007efc3047ae8c in g_main_dispatch (context=0x7efc18000f00) at ../glib/gmain.c:3344
#30 g_main_context_dispatch_unlocked (context=0x7efc18000f00) at ../glib/gmain.c:4152
#31 0x00007efc304dcc98 in g_main_context_iterate_unlocked.isra.0 (context=context@entry=0x7efc18000f00, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../glib/gmain.c:4217
#32 0x00007efc3047c383 in g_main_context_iteration (context=0x7efc18000f00, may_block=1) at ../glib/gmain.c:4282
#33 0x00007efc31c850a3 in QEventDispatcherGlib::processEvents (this=0x558add515ec0, flags=...) at /usr/src/debug/qt6-qtbase-6.7.2-3.fc40.x86_64/src/corelib/kernel/qeventdispatcher_glib.cpp:394
#34 0x00007efc319a3b03 in QEventLoop::exec (this=this@entry=0x7fffb01d3a10, flags=..., flags@entry=...) at /usr/src/debug/qt6-qtbase-6.7.2-3.fc40.x86_64/src/corelib/global/qflags.h:34
#35 0x00007efc3199f9bc in QCoreApplication::exec () at /usr/src/debug/qt6-qtbase-6.7.2-3.fc40.x86_64/src/corelib/global/qflags.h:74
#36 0x00007efc321d67ed in QGuiApplication::exec () at /usr/src/debug/qt6-qtbase-6.7.2-3.fc40.x86_64/src/gui/kernel/qguiapplication.cpp:1926
#37 0x00007efc33d8b189 in QApplication::exec () at /usr/src/debug/qt6-qtbase-6.7.2-3.fc40.x86_64/src/widgets/kernel/qapplication.cpp:2555
#38 0x0000558adaf03b3a in main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/plasma-workspace-6.1.2-2.fc40.x86_64/shell/main.cpp:188
Comment 4 Marco Martin 2024-07-18 09:52:59 UTC
(In reply to Akseli Lahtinen from comment #3)
> #8  Plasma::Theme::~Theme (this=this@entry=0x558ae3b02058, this=<optimized
> out>) at /usr/src/debug/libplasma-6.1.2-1.fc40.x86_64/src/plasma/theme.cpp:85

One thing that looks really weird to me is that line 85 , should happen when a theme gets destroyed that was *not* using the plasma global theme, the deletion comes from the deletion of an attached property Kirigami::Theme.

This should never happen, as far i know on that code path *only* the global plasma theme is used, so the destructor should ogo in the path of line 78 79
Comment 5 Marco Martin 2024-07-18 09:55:05 UTC
can you include a local ~/.config/plasma-org.kde.plasma.desktop-appletsrc  ?

it seems some applet is doing something quite strange that i can't quite reproduce
Comment 6 Steve Cossette 2024-07-18 10:14:03 UTC
Created attachment 171754 [details]
plasma-org.kde.plasma.desktop-appletsrc

Sure thing, here ya go!
Comment 7 cwo 2024-07-30 10:29:33 UTC
*** Bug 490984 has been marked as a duplicate of this bug. ***
Comment 8 TraceyC 2024-08-01 20:55:46 UTC
*** Bug 487102 has been marked as a duplicate of this bug. ***
Comment 9 TraceyC 2024-08-01 22:10:36 UTC
Marking confirmed as there are multiple reports of this
Comment 10 duha.bugs 2024-08-08 17:50:31 UTC
*** Bug 491440 has been marked as a duplicate of this bug. ***
Comment 11 Nicolas Fella 2024-08-15 12:41:49 UTC
(In reply to Marco Martin from comment #4)
> (In reply to Akseli Lahtinen from comment #3)
> > #8  Plasma::Theme::~Theme (this=this@entry=0x558ae3b02058, this=<optimized
> > out>) at /usr/src/debug/libplasma-6.1.2-1.fc40.x86_64/src/plasma/theme.cpp:85
> 
> One thing that looks really weird to me is that line 85 , should happen when
> a theme gets destroyed that was *not* using the plasma global theme, the
> deletion comes from the deletion of an attached property Kirigami::Theme.
> 
> This should never happen, as far i know on that code path *only* the global
> plasma theme is used, so the destructor should ogo in the path of line 78 79

yeah, I also don't see how we end up there.

Looking at the theme code I would have liked to have an explicit Plasma::Theme::globalTheme() singleton instead of this implicit global magic, but that would be an API break
Comment 12 Nate Graham 2024-08-27 18:41:00 UTC
*** Bug 492150 has been marked as a duplicate of this bug. ***
Comment 13 Nate Graham 2025-03-04 18:02:33 UTC
No more duplicates in over 6 months. Steve, can you still ever reproduce this issue in Plasma 6.3. or later? Or is it no longer happening?
Comment 14 Bug Janitor Service 2025-03-19 03:47:07 UTC
๐Ÿ›๐Ÿงน โš ๏ธ This bug has been in NEEDSINFO status with no change for at least 15 days. Please provide the requested information, then set the bug status to REPORTED. If there is no change for at least 30 days, it will be automatically closed as RESOLVED WORKSFORME.

For more information about our bug triaging procedures, please read https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging.

Thank you for helping us make KDE software even better for everyone!
Comment 15 Bug Janitor Service 2025-04-03 03:46:51 UTC
๐Ÿ›๐Ÿงน This bug has been in NEEDSINFO status with no change for at least 30 days. Closing as RESOLVED WORKSFORME.