qt6-declarative/0001-WIP-speculative-gc-fix.patch

38 lines
1.1 KiB
Diff

From 8d58aab6a8bca6a7c4a1a01d087594714b766c56 Mon Sep 17 00:00:00 2001
From: Fabian Kosmale <fabian.kosmale@qt.io>
Date: Thu, 31 Oct 2024 17:14:12 +0100
Subject: [PATCH] WIP: speculative gc fix
Change-Id: I3c1151998771ff8eaeea4925da6bbe3861460c82
---
src/qml/qml/qqmlcontext.cpp | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/qml/qml/qqmlcontext.cpp b/src/qml/qml/qqmlcontext.cpp
index cf6736deb978..45eb72d23ef1 100644
--- a/src/qml/qml/qqmlcontext.cpp
+++ b/src/qml/qml/qqmlcontext.cpp
@@ -11,6 +11,9 @@
#include "qqmlinfo.h"
#include "qqmlabstracturlinterceptor.h"
+
+#include "private/qv4qobjectwrapper_p.h"
+
#include <qjsengine.h>
#include <QtCore/qvarlengtharray.h>
#include <private/qmetaobject_p.h>
@@ -260,6 +263,9 @@ void QQmlContext::setContextProperty(const QString &name, const QVariant &value)
*/
void QQmlContext::setContextProperty(const QString &name, QObject *value)
{
+ if (auto e = engine(); e && value) {
+ QV4::QObjectWrapper::ensureWrapper(e->handle(), value);
+ }
setContextProperty(name, QVariant::fromValue(value));
}
--
2.47.0