Plasma shell restart crashes some apps but not others

When plasma shell restarts (manually using systemctl restart --user plasma-plasmashell or due to a crash - which is basically the same thing) some applications close, while others stay around.

For example, Gwenview when launched from the main menu, stays around when plasma shell restarts, while Gwenview launched by right clicking the desktop and selecting “Open Wallpaper Image” will crash when plasma shell restarts.

This kind of makes sense, I guess? When looking at the output of systemd-cgls, I can see that Gwenview launched to view the wallpaper image is running under plasma-plasmashell.service that runs under the session.slice, while Gwenview launched as an application is running under its own scope - app-org.kde.gwenview-558834e8ee8f4b0ca5dec7689157b8b8.scope - under the app.slice.

The problem is that some applications that I launch from the main menu, while having their own copes under app.slice have all the actual processes under the plasma-plasmashell.service cgroup and then will crash if plasma-plasmashell.service ever restarts.

For example, running Google Chrome, I see its scope:

│   │ │ ├─app-google\x2dchrome-9a981f3eb2424ea18253bacb63872f08.scope 
│   │ │ │ ├─1520608 /opt/google/chrome/chrome
│   │ │ │ ├─1520688 /opt/google/chrome/chrome --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=non>
│   │ │ │ └─1520925 /usr/bin/plasma-browser-integration-host chrome-extension://cimiefiiaegbelhefglklhhakcgmhkai/

but most processes are actually under plasma-plasmashell.service:

│   │ │ ├─plasma-plasmashell.service 
│   │ │ │ ├─1503056 /usr/bin/plasmashell --no-respawn
│   │ │ │ ├─1514833 /lib/x86_64-linux-gnu/libexec/kf6/kioworker /usr/lib/x86_64-linux-gnu/qt6/plugins/kf6/kio/thumbnail.so thumbnail  local:/run/use>
│   │ │ │ ├─1518388 /lib/x86_64-linux-gnu/libexec/kf6/kioworker /usr/lib/x86_64-linux-gnu/qt6/plugins/kf6/kio/tags.so tags  local:/run/user/1000/pla>
│   │ │ │ ├─1520612 cat
│   │ │ │ ├─1520613 cat
│   │ │ │ ├─1520622 /opt/google/chrome/chrome_crashpad_handler --monitor-self --monitor-self-annotation=ptype=crashpad-handler --database=/home/oded>
│   │ │ │ ├─1520624 /opt/google/chrome/chrome_crashpad_handler --no-periodic-tasks --monitor-self-annotation=ptype=crashpad-handler --database=/home>
│   │ │ │ ├─1520630 /opt/google/chrome/chrome --type=zygote --no-zygote-sandbox --crashpad-handler-pid=1520622 --enable-crash-reporter=7aeade26-67b3>
│   │ │ │ ├─1520631 /opt/google/chrome/chrome --type=zygote --crashpad-handler-pid=1520622 --enable-crash-reporter=7aeade26-67b3-4a8c-84e2-4b6a3c90b>
│   │ │ │ ├─1520635 /opt/google/chrome/chrome --type=zygote --crashpad-handler-pid=1520622 --enable-crash-reporter=7aeade26-67b3-4a8c-84e2-4b6a3c90b>
│   │ │ │ ├─1520687 /opt/google/chrome/chrome --type=gpu-process --crashpad-handler-pid=1520622 --enable-crash-reporter=7aeade26-67b3-4a8c-84e2-4b6a>
│   │ │ │ ├─1520691 /opt/google/chrome/chrome --type=utility --utility-sub-type=storage.mojom.StorageService --lang=en-US --service-sandbox-type=uti>
│   │ │ │ ├─1520736 /opt/google/chrome/chrome --type=renderer --crashpad-handler-pid=1520622 --enable-crash-reporter=7aeade26-67b3-4a8c-84e2-4b6a3c9>
│   │ │ │ ├─1520742 /opt/google/chrome/chrome --type=renderer --crashpad-handler-pid=1520622 --enable-crash-reporter=7aeade26-67b3-4a8c-84e2-4b6a3c9>
│   │ │ │ ├─1520889 /opt/google/chrome/chrome --type=renderer --crashpad-handler-pid=1520622 --enable-crash-reporter=7aeade26-67b3-4a8c-84e2-4b6a3c9>
│   │ │ │ ├─1520940 /opt/google/chrome/chrome --type=renderer --crashpad-handler-pid=1520622 --enable-crash-reporter=7aeade26-67b3-4a8c-84e2-4b6a3c9>
│   │ │ │ ├─1521048 /opt/google/chrome/chrome --type=utility --utility-sub-type=data_decoder.mojom.DataDecoderService --lang=en-US --service-sandbox>
│   │ │ │ └─1521078 /opt/google/chrome/chrome --type=utility --utility-sub-type=data_decoder.mojom.DataDecoderService --lang=en-US --service-sandbox>

(the cats are part of the Google Chrome processes tree, I’m not sure what they are supposed to be doing).

I’m guess that the reason Google Chrome does not survive plasma shell restart is that when systemd closes the service - it kills all the processes in its same cgroup, but why are they in that cgroup to begin with? Aren’t they supposed to be in their own scope?

I also have this problem with Eclipse (for which I wrote my own .desktop file) but not many other things - GNOME applications, as another example behave fine, as well as Firefox and snap applications.