Bug 506064 - plasmawindowed crashes with the systemtray applet
Summary: plasmawindowed crashes with the systemtray applet
Status: RESOLVED FIXED
Alias: None
Product: Plasma SDK
Classification: Plasma
Component: plasmoidviewer (other bugs)
Version First Reported In: 6.4.0
Platform: Other Linux
: NOR crash
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-06-23 17:23 UTC by Chris Xiong
Modified: 2025-07-30 15:36 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.5.0
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Xiong 2025-06-23 17:23:03 UTC
SUMMARY
plasmawindowed crashes with the systemtray applet

STEPS TO REPRODUCE
1. Simply run "plasmawindowed org.kde.plasma.systemtray"
2. It will segfault. There's a small chance that it may not crash on the first attempt. If that's the case, repeat the command and it definitely will crash.

OBSERVED RESULT
plasmawindowed crashes.

EXPECTED RESULT
plasmawindowed shouldn't crash.

SOFTWARE/OS VERSIONS

Reproduced on Gentoo with the following package versions:

KDE Plasma Version: 6.4.0
KDE Frameworks Version: 6.15.0
Qt Version: 6.9.1

Also reproducible on Arch Linux (definitely Plasma 6.4.0, although unable to confirm versions for other components at the moment)

ADDITIONAL INFORMATION

I know this is a niche use case. I apologize in advance if this wasting the team's time.

I have traced the crash to the following line in plasma-workspace/applets/systemtray/systemtray.cpp, inside function SystemTray::restoreContents, at the line `m_plasmoidRegistry->init();`

where m_plasmoidRegistry is null.

If I place a guard around that call, i.e. making the line "if (m_plasmoidRegistry) m_plasmoidRegistry->init();", plasmawindowed still crashes with the following stack trace:

#0  0x00007ffff7dc852e in Plasma::Corona::config() const () at /usr/lib64/libPlasma.so.6
#1  0x00007ffff7dbd101 in Plasma::Containment::restore(KConfigGroup&) () at /usr/lib64/libPlasma.so.6
#2  0x000055555555d25a in PlasmaWindowedCorona::loadApplet (this=0x555555a83870, applet=..., arguments=...)
    at ~/devel/git/plasma-workspace/plasma-windowed/plasmawindowedcorona.cpp:66

the line in PlasmaWindowedCorona::loadApplet being "a->restore(cg);". It appears that inside Plasma::Containment::restore, "corona()" returned null. So inserting "a->setParent(this);" before that line in PlasmaWindowedCorona::loadApplet fixed the issue, and plasmawindowed no longer crashes from this point.

An alternative working solution to the first part of the issue is to instantiate m_settings and m_plasmoidRegistry if they are null when the latter is used in SystemTray::restoreContents. SystemTray::init will also be changed accordingly to avoid creating them twice.

I'm not submitting a patch because I have no idea whether these modifications are the proper solution, but I will do so if the team deems that they are.
Comment 1 TraceyC 2025-06-24 23:02:33 UTC
Thanks for the bug report, and for digging into the code to try to narrow down the problem. 

I'm able to reproduce the crash with the same command on Plasma 6.3.5 but not on git-master. On git-master, the command brings up a windowed version of the System Tray as expected.

I don't know the exact merge request or commit that might have fixed this, but it is likely fixed.
Comment 2 Chris Xiong 2025-06-25 15:53:05 UTC
(In reply to TraceyC from comment #1)

> I'm able to reproduce the crash with the same command on Plasma 6.3.5 but
> not on git-master. On git-master, the command brings up a windowed version
> of the System Tray as expected.
> 
> I don't know the exact merge request or commit that might have fixed this,
> but it is likely fixed.

Thanks for that information! The debugging I did was indeed done on the 6.4.0 release. However I just tested the master branch (was on commit e12b4a9c8 of plasma-workspace) and unfortunately the program still crashes in exactly the same fashion on my setup. One notable caveat is that I am still building it against other components (kf6, libplasma, etc) that are provided by system packages. Are you using git-master for those components too?

I couldn't recall observing the crash on Plasma 6.3.5 though. My system was on 6.3.5 before updating to 6.4.0, and I don't remember plasmawindowed crashing before the update.
Comment 3 TraceyC 2025-06-25 19:53:00 UTC
(In reply to Chris Xiong from comment #2)
> Thanks for that information! The debugging I did was indeed done on the
> 6.4.0 release. However I just tested the master branch (was on commit
> e12b4a9c8 of plasma-workspace) and unfortunately the program still crashes
> in exactly the same fashion on my setup. 

The testing I had done was with plasma-desktop on commit a1e2d0a7f3, which is from 10 days ago from today.
I rebuilt workspace just now and re-tested, with plasma-workspace on e12b4a9c86 as well and now it does core dump on my machine.

> One notable caveat is that I am
> still building it against other components (kf6, libplasma, etc) that are
> provided by system packages. Are you using git-master for those components
> too?

I'm also using system packages for libplasma etc.

I'll re-open this and let the developers take it from here.
Comment 4 TraceyC 2025-06-25 19:53:08 UTC
.
Comment 5 Bug Janitor Service 2025-07-26 15:20:19 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/5708
Comment 6 Chris Xiong 2025-07-26 15:21:40 UTC
I was a little impatient, so I submitted my patch for this bug here: https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/5708

Just as an update, I was able to confirm that the same crash still exists in both Plasma 6.4.3 and the git revision that my patch is based on.
Comment 7 Nate Graham 2025-07-30 15:36:21 UTC
Git commit 6f7ce314580a939c093ba54cf35998061f777662 by Nate Graham, on behalf of Chris Xiong.
Committed on 30/07/2025 at 15:36.
Pushed by ngraham into branch 'master'.

applets/systemtray: ensure registry and settings are set in restoreContents

Also parent applet plugins to their PlasmaWindowedCorona instantiator.
FIXED-IN: 6.5.0

M  +16   -6    applets/systemtray/systemtray.cpp
M  +1    -0    applets/systemtray/systemtray.h
M  +3    -0    plasma-windowed/plasmawindowedcorona.cpp

https://invent.kde.org/plasma/plasma-workspace/-/commit/6f7ce314580a939c093ba54cf35998061f777662