From 21fec77de7fdafc389cdb7cee1aa2cdec6fa2992 Mon Sep 17 00:00:00 2001 From: outfoxxed Date: Sat, 15 Aug 2026 15:55:46 -0700 Subject: [PATCH] wayland/toplevel: null check window passed to Toplevel::setRectangle Fixes Toplevel::unsetRectangle, which passes a null. --- changelog/next.md | 1 + src/wayland/toplevel/qml.cpp | 2 +- src/wayland/toplevel/wlr_toplevel.cpp | 7 +++++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/changelog/next.md b/changelog/next.md index 0f9e25c..f922d35 100644 --- a/changelog/next.md +++ b/changelog/next.md @@ -13,3 +13,4 @@ - Fixed `qs kill` not waiting for the process to exit. - Fixed IPC calls from children of a crashed and relaunched process crashing. - Fixed JsonAdapter crashing when deserializing new objects into an array. +- Fixed `Toplevel.unsetRectangle` crashing when calle. diff --git a/src/wayland/toplevel/qml.cpp b/src/wayland/toplevel/qml.cpp index ea09e09..3da9f7b 100644 --- a/src/wayland/toplevel/qml.cpp +++ b/src/wayland/toplevel/qml.cpp @@ -98,7 +98,7 @@ void Toplevel::setRectangle(QObject* window, QRect rect) { } this->rectangle = rect; - this->handle->setRectangle(proxyWindow->backingWindow(), rect); + this->handle->setRectangle(proxyWindow ? proxyWindow->backingWindow() : nullptr, rect); } void Toplevel::unsetRectangle() { this->setRectangle(nullptr, QRect()); } diff --git a/src/wayland/toplevel/wlr_toplevel.cpp b/src/wayland/toplevel/wlr_toplevel.cpp index fe6f1b3..6055e22 100644 --- a/src/wayland/toplevel/wlr_toplevel.cpp +++ b/src/wayland/toplevel/wlr_toplevel.cpp @@ -121,8 +121,11 @@ void ToplevelHandle::setRectangle(QWindow* window, QRect rect) { } } - QObject::disconnect(this->rectWindow, nullptr, this, nullptr); - this->rectWindow = nullptr; + if (this->rectWindow) { + QObject::disconnect(this->rectWindow, nullptr, this, nullptr); + this->rectWindow = nullptr; + } + return; }