Bug 487684

Summary: Plasmashell crashes in Plasma::Containment::lastScreen() after ShellCorona::createWaitingPanels() when unlocking screen after resuming from sleep while external screen is connected over HDMI
Product: [Plasma] plasmashell Reporter: postix <postix>
Component: generic-crashAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED FIXED    
Severity: crash CC: felix.schmidt.1, kde.whxeb, kdedev, nate, notmart
Priority: NOR Keywords: multiscreen
Version: 6.0.5   
Target Milestone: 1.0   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed In: 6.2.4
Sentry Crash Report:
Attachments: Full Stack Trace (Plasma 6.0.5)

Description postix 2024-05-28 11:21:43 UTC
SUMMARY

Plasmashell crashes when logging when an external screen connected over HDMI

STEPS TO REPRODUCE
1. Sleep
2. Login in in locked session

OBSERVED RESULT
Plasmashell crashes but recovers itself


```
Core was generated by `/usr/bin/plasmashell --no-respawn'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=11, no_tid=no_tid@entry=0) at pthread_kill.c:44
44            return INTERNAL_SYSCALL_ERROR_P (ret) ? INTERNAL_SYSCALL_ERRNO (ret) : 0;                                                                                                                                                     
[Current thread is 1 (Thread 0x7f5dcb791b00 (LWP 5193))]
(gdb) bt
#0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=11, no_tid=no_tid@entry=0) at pthread_kill.c:44
#1  0x00007f5dd00ab1b3 in __pthread_kill_internal (threadid=<optimized out>, signo=11) at pthread_kill.c:78
#2  0x00007f5dd005365e in __GI_raise (sig=11) at ../sysdeps/posix/raise.c:26
#3  0x00007f5dd34746a5 in KCrash::defaultCrashHandler (sig=11) at /usr/src/debug/kf6-kcrash-6.2.0-1.fc40.x86_64/src/kcrash.cpp:593
#4  0x00007f5dd0053710 in <signal handler called> () at /lib64/libc.so.6
#5  Plasma::Containment::lastScreen (this=this@entry=0x4e36c8ebd9f23aef) at /usr/src/debug/libplasma-6.0.5-1.fc40.x86_64/src/plasma/containment.cpp:492
#6  0x00005649e94389cd in ShellCorona::createWaitingPanels (this=<optimized out>) at /usr/src/debug/plasma-workspace-6.0.5-1.fc40.x86_64/shell/shellcorona.cpp:1496
#7  0x00007f5dd07fa3f4 in QtPrivate::QSlotObjectBase::call (this=0x5649ea267a50, r=<optimized out>, a=0x7ffd3c174e20) at /usr/src/debug/qt6-qtbase-6.7.0-5.fc40.x86_64/src/corelib/kernel/qobjectdefs_impl.h:469
#8  doActivate<false> (sender=0x5649ea03f940, signal_index=3, argv=0x7ffd3c174e20) at /usr/src/debug/qt6-qtbase-6.7.0-5.fc40.x86_64/src/corelib/kernel/qobject.cpp:4078
#9  0x00007f5dd07f09a7 in QMetaObject::activate (sender=<optimized out>, m=m@entry=0x7f5dd0c83100, local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x7ffd3c174e20)
    at /usr/src/debug/qt6-qtbase-6.7.0-5.fc40.x86_64/src/corelib/kernel/qobject.cpp:4138
#10 0x00007f5dd08094bd in QTimer::timeout (this=<optimized out>, _t1=...) at /usr/src/debug/qt6-qtbase-6.7.0-5.fc40.x86_64/redhat-linux-build/src/corelib/Core_autogen/include/moc_qtimer.cpp:224
#11 0x00007f5dd07ebccf in QObject::event (this=0x5649ea03f940, e=0x7ffd3c174fd0) at /usr/src/debug/qt6-qtbase-6.7.0-5.fc40.x86_64/src/corelib/kernel/qobject.cpp:1476
#12 0x00007f5dd2b8b368 in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0x5649ea03f940, e=0x7ffd3c174fd0) at /usr/src/debug/qt6-qtbase-6.7.0-5.fc40.x86_64/src/widgets/kernel/qapplication.cpp:3287
#13 0x00007f5dd0795ab8 in QCoreApplication::notifyInternal2 (receiver=0x5649ea03f940, event=0x7ffd3c174fd0) at /usr/src/debug/qt6-qtbase-6.7.0-5.fc40.x86_64/src/corelib/kernel/qcoreapplication.cpp:1134
#14 0x00007f5dd0795d1d in QCoreApplication::sendEvent (receiver=<optimized out>, event=<optimized out>) at /usr/src/debug/qt6-qtbase-6.7.0-5.fc40.x86_64/src/corelib/kernel/qcoreapplication.cpp:1575
#15 0x00007f5dd094d797 in QTimerInfoList::activateTimers (this=0x5649e9d65730) at /usr/src/debug/qt6-qtbase-6.7.0-5.fc40.x86_64/src/corelib/kernel/qtimerinfo_unix.cpp:436
#16 0x00007f5dd0a7bdb9 in timerSourceDispatch (source=<optimized out>) at /usr/src/debug/qt6-qtbase-6.7.0-5.fc40.x86_64/src/corelib/kernel/qeventdispatcher_glib.cpp:150
#17 0x00007f5dcf3616ac in g_main_dispatch (context=0x7f5db8000f00) at ../glib/gmain.c:3344
#18 g_main_context_dispatch_unlocked (context=0x7f5db8000f00) at ../glib/gmain.c:4152
#19 0x00007f5dcf3c2708 in g_main_context_iterate_unlocked.isra.0 (context=context@entry=0x7f5db8000f00, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../glib/gmain.c:4217
#20 0x00007f5dcf362b23 in g_main_context_iteration (context=0x7f5db8000f00, may_block=1) at ../glib/gmain.c:4282
#21 0x00007f5dd0a7bf83 in QEventDispatcherGlib::processEvents (this=0x5649e9d4fa40, flags=...) at /usr/src/debug/qt6-qtbase-6.7.0-5.fc40.x86_64/src/corelib/kernel/qeventdispatcher_glib.cpp:394
#22 0x00007f5dd07a26b3 in QEventLoop::exec (this=this@entry=0x7ffd3c1752a0, flags=..., flags@entry=...) at /usr/src/debug/qt6-qtbase-6.7.0-5.fc40.x86_64/src/corelib/global/qflags.h:34
#23 0x00007f5dd079e63c in QCoreApplication::exec () at /usr/src/debug/qt6-qtbase-6.7.0-5.fc40.x86_64/src/corelib/global/qflags.h:74
#24 0x00007f5dd0fd518d in QGuiApplication::exec () at /usr/src/debug/qt6-qtbase-6.7.0-5.fc40.x86_64/src/gui/kernel/qguiapplication.cpp:1926
#25 0x00007f5dd2b8b2d9 in QApplication::exec () at /usr/src/debug/qt6-qtbase-6.7.0-5.fc40.x86_64/src/widgets/kernel/qapplication.cpp:2555
#26 0x00005649e93f9ea5 in main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/plasma-workspace-6.0.5-1.fc40.x86_64/shell/main.cpp:214
```

SOFTWARE/OS VERSIONS
Operating System: Fedora Linux 40
KDE Plasma Version: 6.0.5
KDE Frameworks Version: 6.2.0
Qt Version: 6.7.0
Kernel Version: 6.8.10-300.fc40.x86_64 (64-bit)
Graphics Platform: Wayland
Comment 1 postix 2024-05-28 11:26:26 UTC
Created attachment 169907 [details]
Full Stack Trace (Plasma 6.0.5)
Comment 2 Marco Martin 2024-05-28 13:04:20 UTC
From the sources of 6.0.5, it means that a panel in m_waitingPanels has been deleted before being created
Comment 3 Marco Martin 2024-05-28 13:05:24 UTC
 for (Plasma::Containment *cont : std::as_const(m_waitingPanels)) {
        // ignore non existing (yet?) screens
        int requestedScreen = cont->lastScreen();  <=== crash
        if (requestedScreen < 0) {
            requestedScreen = 0;
        }
Comment 4 Marco Martin 2024-05-28 13:11:20 UTC
however during a sleep/resume cycle the containment itself should never be deleted, perhaps its view if the screen reported itself disconnecte, but not Containment*
Comment 5 Nate Graham 2024-06-12 21:08:09 UTC

*** This bug has been marked as a duplicate of bug 478071 ***
Comment 6 Nate Graham 2024-07-29 19:13:58 UTC
*** Bug 490541 has been marked as a duplicate of this bug. ***
Comment 7 TraceyC 2024-08-19 17:06:28 UTC
*** Bug 447773 has been marked as a duplicate of this bug. ***
Comment 8 TraceyC 2024-08-19 17:07:48 UTC
Confirming since there are multiple reports of the same crash
Comment 9 Bug Janitor Service 2024-11-18 13:05:39 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/4922
Comment 10 Marco Martin 2024-11-21 09:30:56 UTC
Git commit 0e933b4607e88a9fbd4db9dfd78b69d895cd0b8b by Marco Martin.
Committed on 21/11/2024 at 09:30.
Pushed by mart into branch 'master'.

plasmashell: begin earlier to watch for panel destruction

watch for panel containment destructionn earlier, since it's
inserted in m_waitingPanels, for the unlikely event of a containment
destruction before the panel is assigned a view

M  +13   -0    shell/shellcorona.cpp

https://invent.kde.org/plasma/plasma-workspace/-/commit/0e933b4607e88a9fbd4db9dfd78b69d895cd0b8b
Comment 11 Marco Martin 2024-11-21 11:05:31 UTC
Git commit 434e13d01e0e9c07548e2a46c0be45050720bba7 by Marco Martin.
Committed on 21/11/2024 at 11:05.
Pushed by mart into branch 'Plasma/6.2'.

plasmashell: begin earlier to watch for panel destruction

watch for panel containment destructionn earlier, since it's
inserted in m_waitingPanels, for the unlikely event of a containment
destruction before the panel is assigned a view


(cherry picked from commit 0e933b4607e88a9fbd4db9dfd78b69d895cd0b8b)

Co-authored-by: Marco Martin <notmart@gmail.com>

M  +13   -0    shell/shellcorona.cpp

https://invent.kde.org/plasma/plasma-workspace/-/commit/434e13d01e0e9c07548e2a46c0be45050720bba7