From 6966fc025c2bb96cbac31ecfacabb11537fd26e2 Mon Sep 17 00:00:00 2001 From: outfoxxed Date: Fri, 8 Mar 2024 18:33:01 -0800 Subject: [PATCH] all: ensure QObject ownership is Cpp when required --- src/core/proxywindow.cpp | 8 +++++--- src/core/variants.cpp | 2 ++ src/io/socket.cpp | 2 ++ src/wayland/session_lock.cpp | 1 + 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/core/proxywindow.cpp b/src/core/proxywindow.cpp index f825be6..1c1796a 100644 --- a/src/core/proxywindow.cpp +++ b/src/core/proxywindow.cpp @@ -1,6 +1,7 @@ #include "proxywindow.hpp" #include +#include #include #include #include @@ -13,8 +14,10 @@ #include "region.hpp" #include "reload.hpp" -ProxyWindowBase::ProxyWindowBase(QObject* parent): Reloadable(parent) { - this->mContentItem = new QQuickItem(); // NOLINT +ProxyWindowBase::ProxyWindowBase(QObject* parent) + : Reloadable(parent) + , mContentItem(new QQuickItem()) { + QQmlEngine::setObjectOwnership(this->mContentItem, QQmlEngine::CppOwnership); this->mContentItem->setParent(this); QObject::connect(this, &ProxyWindowBase::widthChanged, this, &ProxyWindowBase::onWidthChanged); @@ -34,7 +37,6 @@ void ProxyWindowBase::onReload(QObject* oldInstance) { Reloadable::reloadRecursive(this->mContentItem, oldInstance); this->mContentItem->setParentItem(this->window->contentItem()); - this->mContentItem->setWidth(this->width()); this->mContentItem->setHeight(this->height()); diff --git a/src/core/variants.cpp b/src/core/variants.cpp index 3a05c47..e564e1b 100644 --- a/src/core/variants.cpp +++ b/src/core/variants.cpp @@ -104,6 +104,8 @@ void Variants::updateVariants() { continue; } + QQmlEngine::setObjectOwnership(instance, QQmlEngine::CppOwnership); + instance->setParent(this); this->instances.insert(variant, instance); } diff --git a/src/io/socket.cpp b/src/io/socket.cpp index fa840f0..f5e0b53 100644 --- a/src/io/socket.cpp +++ b/src/io/socket.cpp @@ -187,6 +187,8 @@ void SocketServer::onNewConnection() { return; } + QQmlEngine::setObjectOwnership(instance, QQmlEngine::CppOwnership); + this->mSockets.append(instance); instance->setParent(this); diff --git a/src/wayland/session_lock.cpp b/src/wayland/session_lock.cpp index bd93dc0..a7aa473 100644 --- a/src/wayland/session_lock.cpp +++ b/src/wayland/session_lock.cpp @@ -157,6 +157,7 @@ SessionLockSurface::SessionLockSurface(QObject* parent) : Reloadable(parent) , mContentItem(new QQuickItem()) , ext(new LockWindowExtension(this)) { + QQmlEngine::setObjectOwnership(this->mContentItem, QQmlEngine::CppOwnership); this->mContentItem->setParent(this); // clang-format off