https://bugs.kde.org/show_bug.cgi?id=528380

            Bug ID: 528380
           Summary: System Settings crashes in QScreen::name() from
                    WallpaperModule::onWallpaperChanged() after a screen
                    is removed (null m_selectedScreen, unguarded after bug
                    521078 fix)
    Classification: Applications
           Product: systemsettings
      Version First master
       Reported In:
          Platform: Fedora RPMs
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: kcm_wallpaper
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
  Target Milestone: ---

Created attachment 198094
  --> https://bugs.kde.org/attachment.cgi?id=198094&action=edit
Crash log

SUMMARY
System Settings crashed with SIGSEGV while the Wallpaper page was open. The
crash is in QScreen::name() called from WallpaperModule, delivered via
QDBusConnectionPrivate::deliverCall, i.e. the org.kde.PlasmaShell
wallpaperChanged D-Bus signal landing in
WallpaperModule::onWallpaperChanged(uint).

The fix for bug 521078 (plasma-workspace a62890b6, "kcms/wallpaper: Avoid
storing screen as raw pointer") turned m_selectedScreen into a QPointer, so it
becomes null when the screen goes away. But onWallpaperChanged() still only has
Q_ASSERT(m_selectedScreen), which is compiled out in release builds, and then
calls m_selectedScreen->name(). So the dangling-pointer crash became a
null-pointer crash on the same path. This is still the case on master as of
today (last change to kcms/wallpaper/wallpapermodule.cpp was 2026-08-16).

STEPS TO REPRODUCE
1. Open System Settings, go to Wallpaper, leave it open.
2. Remove a screen (suspend/resume, or turn off/unplug a monitor) so the
selected QScreen is destroyed.
3. Wait for plasmashell to emit wallpaperChanged (it does so when it re-creates
desktop containments for the changed screen set).

OBSERVED RESULT
System Settings segfaults. Backtrace attached. Relevant frames:
#4 QScreen::name() const
#5 WallpaperModule::qt_static_metacall
#7 QDBusConnectionPrivate::deliverCall

EXPECTED RESULT
No crash. onWallpaperChanged() should return early when m_selectedScreen is
null, like onScreenChanged() and the outputOrderChanged lambda already do.

SOFTWARE/OS VERSIONS
Linux: Fedora 45, kernel 7.2.15-300.fc45.x86_64
KDE Plasma: 6.8.2 (plasma-workspace-6.8.2-1.fc45, plasma-desktop-6.8.2-1.fc45)
Qt: 6.11.2
Session: Wayland

ADDITIONAL INFORMATION
Process had been running for a long time 201), so the KCM was open across a
screentopology change.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to