From 990a8badab7794180b31f34b77721e17a3942820 Mon Sep 17 00:00:00 2001 From: outfoxxed Date: Sat, 15 Aug 2026 17:46:03 -0700 Subject: [PATCH] core/popupanchor: null check mItem in onItemWindowChanged Also emit itemChanged in PopupAnchor::setItem(). --- changelog/next.md | 1 + src/core/popupanchor.cpp | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/changelog/next.md b/changelog/next.md index 74554b5..1b391f0 100644 --- a/changelog/next.md +++ b/changelog/next.md @@ -18,3 +18,4 @@ - Fixed `ColorQuantizer` deletion crashing if an operation was live. - Fixed crashes when failing to create a `ScreencopyView`. - Fixed `PwNodePeakMonitor` crashing when sampling a stream with mismatched channels from the node. +- Fixed unsetting `PopupAnchor.item` causing a crash. diff --git a/src/core/popupanchor.cpp b/src/core/popupanchor.cpp index ca817c9..7eed1d2 100644 --- a/src/core/popupanchor.cpp +++ b/src/core/popupanchor.cpp @@ -93,6 +93,8 @@ void PopupAnchor::setItem(QQuickItem* item) { QObject::connect(item, &QObject::destroyed, this, &PopupAnchor::onItemDestroyed); QObject::connect(item, &QQuickItem::windowChanged, this, &PopupAnchor::onItemWindowChanged); } + + emit this->itemChanged(); } void PopupAnchor::onWindowDestroyed() { @@ -109,7 +111,7 @@ void PopupAnchor::onItemDestroyed() { } void PopupAnchor::onItemWindowChanged() { - if (auto* window = qobject_cast(this->mItem->window())) { + if (auto* window = qobject_cast(this->mItem ? this->mItem->window() : nullptr)) { this->setWindowInternal(window->proxy()); } else { this->setWindowInternal(nullptr);