[plasma/kwin/Plasma/6.7] src/tiles: tiles: fix null pointer dereference in CustomTile::moveByPixels

Vlad Zahorodnii <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 706e4892c62c2d35636dc9bd2193f453d3224635 by Vlad Zahorodnii, on behalf of zhang shoucheng.
Committed on 06/08/2026 at 08:57.
Pushed by vladz into branch 'Plasma/6.7'.

tiles: fix null pointer dereference in CustomTile::moveByPixels

The root tile has no parent tile, so parentTile() returns nullptr.
When the tiles editor drags the root layout tile, e.g. when no tiling
layout is configured on a desktop, the unchecked dereference of the
parent tile crashes KWin. Null-check parentTile() before using it,
consistent with remove() and nextTileAt().

(cherry picked from commit e1c94f5ef9d866ecf27b2278c9e852da0d20ef56)

M  +2    -1    src/tiles/customtile.cpp

https://invent.kde.org/plasma/kwin/-/commit/706e4892c62c2d35636dc9bd2193f453d3224635

diff --git a/src/tiles/customtile.cpp b/src/tiles/customtile.cpp
index 70fa4485bea..a1ec5bb979d 100644
--- a/src/tiles/customtile.cpp
+++ b/src/tiles/customtile.cpp
@@ -258,7 +258,8 @@ QList<CustomTile *> CustomTile::split(KWin::Tile::LayoutDirection newDirection)
 
 void CustomTile::moveByPixels(const QPointF &delta)
 {
-    if (static_cast<CustomTile *>(parentTile())->layoutDirection() != LayoutDirection::Floating) {
+    const auto parent = static_cast<CustomTile *>(parentTile());
+    if (!parent || parent->layoutDirection() != LayoutDirection::Floating) {
         return;
     }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.