From 04b4ae3ba8f5d281cdabd543375844d20fb7d422 Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Tue, 24 Mar 2026 01:52:00 +1100 Subject: [PATCH] fix: use QPointer for CachingImageManager::m_item Raw QQuickItem* was not tracked for destruction, causing use-after-free if the QML engine destroyed the item while an async sha256 future was in flight. --- plugin/src/Caelestia/Internal/cachingimagemanager.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugin/src/Caelestia/Internal/cachingimagemanager.hpp b/plugin/src/Caelestia/Internal/cachingimagemanager.hpp index 3611699b..1b707414 100644 --- a/plugin/src/Caelestia/Internal/cachingimagemanager.hpp +++ b/plugin/src/Caelestia/Internal/cachingimagemanager.hpp @@ -2,6 +2,7 @@ #include #include +#include #include namespace caelestia::internal { @@ -18,8 +19,7 @@ class CachingImageManager : public QObject { public: explicit CachingImageManager(QObject* parent = nullptr) - : QObject(parent) - , m_item(nullptr) {} + : QObject(parent) {} [[nodiscard]] QQuickItem* item() const; void setItem(QQuickItem* item); @@ -46,7 +46,7 @@ signals: private: QString m_shaPath; - QQuickItem* m_item; + QPointer m_item; QUrl m_cacheDir; QString m_path;