From aa7bbb00c92198f7de88710172a1e3d3c60d2c5f Mon Sep 17 00:00:00 2001 From: deepin-wm Date: Thu, 2 Jul 2026 18:35:01 +0800 Subject: [PATCH] fix(wallpaper): add default member initializers to config structs WallpaperWorkspaceConfig and WallpaperOutputConfig had uninitialized members (workspaceId, desktopWallpapertype, enable, etc.) which led to undefined behavior when default-constructed. WM-29 --- src/wallpaper/wallpaperconfig.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/wallpaper/wallpaperconfig.h b/src/wallpaper/wallpaperconfig.h index 171540f230..1ad2d59fae 100644 --- a/src/wallpaper/wallpaperconfig.h +++ b/src/wallpaper/wallpaperconfig.h @@ -11,10 +11,10 @@ class WallpaperWorkspaceConfig { public: - int workspaceId; + int workspaceId = 0; QString desktopWallpaper; - TreelandWallpaperInterfaceV1::WallpaperType desktopWallpapertype; - bool enable; + TreelandWallpaperInterfaceV1::WallpaperType desktopWallpapertype = TreelandWallpaperInterfaceV1::Image; + bool enable = true; QJsonObject toJson() const; @@ -26,8 +26,8 @@ class WallpaperOutputConfig { QString outputName; QString lockscreenWallpaper; QList workspaces; - TreelandWallpaperInterfaceV1::WallpaperType lockScreenWallpapertype; - bool enable; + TreelandWallpaperInterfaceV1::WallpaperType lockScreenWallpapertype = TreelandWallpaperInterfaceV1::Image; + bool enable = true; QJsonObject toJson() const; bool containsWorkspace(int id) const;