Bug 505890

Summary: plasmashell asserts in `m_desktopViewForScreen.count() == screens.count()` upon creating new Virtual Desktop (via wlx-overlay-s)
Product: [Plasma] plasmashell Reporter: daniel <daniel>
Component: ContainmentAssignee: Plasma Bugs List <plasma-bugs-null>
Status: REPORTED ---    
Severity: crash CC: nate, notmart, vlad.zahorodnii
Priority: NOR    
Version First Reported In: 6.4.0   
Target Milestone: 1.0   
Platform: Neon   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: backtrace #1
backtrace #2

Description daniel@oneill.app 2025-06-21 06:15:24 UTC
Created attachment 182463 [details]
backtrace #1

SUMMARY
Upon creating a new Virtual Desktop display (in this case, via wlx-overlay-s, a VR desktop kinda thing,) the desktop is *apparently* created (with wallpaper), but plasmashell immediately crashes.

STEPS TO REPRODUCE
1. From wlx-overlay-s config (C) in VR, select "M1 Show/Hide" under Mirrors
2. On desktop, click "New Virtual Desktop" on resulting portal popup
3. 

OBSERVED RESULT
plasmashell crashes, displaying 4 drkonqi popups

EXPECTED RESULT
A usable virtual desktop to be created

SOFTWARE/OS VERSIONS
Operating System: KDE neon User Edition
KDE Plasma Version: 6.4.0
KDE Frameworks Version: 6.15.0
Qt Version: 6.9.0
Kernel Version: 6.11.0-26-generic (64-bit)
Graphics Platform: Wayland
Processors: 32 × Intel® Core™ i9-14900K
Memory: 64 GiB of RAM (62.5 GiB usable)
Graphics Processor: Radeon RX 7900 XT


ADDITIONAL INFORMATION
Under both Gentoo and Fedora 39, 40, and 41 this feature worked as of 6.2.0 as I remember, though I may be mistaken on the specific version.
Crash occurs on both Xorg and Wayland.
Crash appears to occur in at least two different parts of code. Both crashes produced via the same usage pattern, both backtraces attached.
Comment 1 daniel@oneill.app 2025-06-21 06:16:03 UTC
Created attachment 182464 [details]
backtrace #2
Comment 2 daniel@oneill.app 2025-06-21 06:23:08 UTC
A quick observation of the crash behaviour:

Attempting to re-launch plasmashell after (attempting to) create a new Virtual Desktop via wlx-overlay-s will crash on launch until wlx-overlay-s is CLOSED:

```
ASSERT: "false" in file ./shell/screenpool.cpp, line 404

Thread 1 "plasmashell" received signal SIGABRT, Aborted.
```

The first backtrace (backtrace #1) is the observed result when plasmashell is in sane state and virtual display is created.
The second backtrace (backtrace #2) is the result of attempting to re-launch plasmashell without first closing (killing) wlx-overlay-s.
Comment 3 Nate Graham 2025-06-24 16:08:17 UTC
Relevant part:

#7  qt_message(QtMsgType, const QMessageLogContext &, const char *, typedef __va_list_tag __va_list_tag *) (msgType=msgType@entry=QtFatalMsg, context=..., msg=msg@entry=0x73f323e49e88 "ASSERT: \"%s\" in file %s, line %d", ap=ap@entry=0x7ffd5e62e928) at /usr/src/qt6-base-6.9.0-0zneon+24.04+noble+release+build112/src/corelib/global/qlogging.cpp:381
        buf = {d = {d = 0x5f8d40149700, ptr = 0x5f8d40149710 u"ASSERT: \"m_desktopViewForScreen.count() == screens.count()\" in file ./shell/shellcorona.cpp, line 1462", size = 102}, static _empty = 0 u'\000'}
#8  0x000073f324125ac7 in QMessageLogger::fatal (this=<optimized out>, msg=0x73f323e49e88 "ASSERT: \"%s\" in file %s, line %d") at /usr/src/qt6-base-6.9.0-0zneon+24.04+noble+release+build112/src/corelib/global/qlogging.cpp:883
        ctxt = {<QMessageLogContext> = {static CurrentVersion = 2, version = 3, line = 1462, file = 0x5f8d3902652d "./shell/shellcorona.cpp", function = 0x0, category = 0x73f323e422c3 "default"}, static DefaultBacktraceDepth = 32, backtrace = std::optional [no contained value]}
        ap = {{gp_offset = 40, fp_offset = 48, overflow_arg_area = 0x7ffd5e62eb60, reg_save_area = 0x7ffd5e62ea90}}
#9  0x000073f3241100d1 in qt_assert (assertion=assertion@entry=0x5f8d39023798 "m_desktopViewForScreen.count() == screens.count()", file=file@entry=0x5f8d3902652d "./shell/shellcorona.cpp", line=line@entry=1462) at /usr/src/qt6-base-6.9.0-0zneon+24.04+noble+release+build112/src/corelib/global/qassert.cpp:105
#10 0x00005f8d38f62908 in ShellCorona::handleScreenOrderChanged (this=<optimized out>, screens=...) at /usr/src/plasma-workspace-4:6.4.0-0zneon+24.04+noble+release+build41/shell/shellcorona.cpp:1462
        allDesktops = {<QListSpecialMethods<DesktopView*>> = {<QListSpecialMethodsBase<DesktopView*>> = {<No data fields>}, <No data fields>}, d = {d = 0x5f8d3cd4a940, ptr = 0x5f8d3cd4a950, size = 2}}
        allPanels = {<QListSpecialMethods<PanelView*>> = {<QListSpecialMethodsBase<PanelView*>> = {<No data fields>}, <No data fields>}, d = {d = 0x73f1f44fa870, ptr = 0x73f1f44fa880, size = 1}}
#11 0x00005f8d38fbef7c in QtPrivate::FunctorCall<std::integer_sequence<unsigned long, 0ul>, QtPrivate::List<QList<QScreen*> const&>, void, void (ShellCorona::*)(QList<QScreen*>)>::call(void (ShellCorona::*)(QList<QScreen*>), ShellCorona*, void**)::{lambda()#1}::operator()() const (__closure=<optimized out>) at /usr/include/x86_64-linux-gnu/qt6/QtCore/qarraydata.h:60
        arg = <optimized out>