aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmlcompiler/qqmljscompiler.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2023-10-03 17:44:20 +0200
committerUlf Hermann <ulf.hermann@qt.io>2023-10-07 19:00:16 +0200
commit1d8859ce3a3d161ffa2ccd74f195b276795a5af5 (patch)
tree590e495e60841a9cabe3783800771be82be541a5 /src/qmlcompiler/qqmljscompiler.cpp
parentbb698b7f2e974a23b688dd15393f6a550448a5a8 (diff)
QtQml: Fix return type constructions when calling methods
We now expect the return type to be initialized in all cases. This is in line with what the various metacall() methods expect. Unifying this behavior makes it much easier to reason about and avoids complicated bugs and memory leaks. The code generated by QmlCompiler always passes initialized values for the return type anyway. Amends commit 4f1b9156a48e44cf1f127a4563d0ac69ab436f12 Amends commit 02c4c817fe1cfa4766c56759be99fb081382a586 Change-Id: I26c016676dd82c91d6ef81762b5c4b599f6f7f72 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'src/qmlcompiler/qqmljscompiler.cpp')
-rw-r--r--src/qmlcompiler/qqmljscompiler.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/qmlcompiler/qqmljscompiler.cpp b/src/qmlcompiler/qqmljscompiler.cpp
index 2f1bc7a391..69d80283e3 100644
--- a/src/qmlcompiler/qqmljscompiler.cpp
+++ b/src/qmlcompiler/qqmljscompiler.cpp
@@ -468,7 +468,7 @@ void wrapCall(const QQmlPrivate::AOTCompiledContext *aotContext, void *dataPtr,
binding(aotContext, argumentsPtr);
} else {
if (dataPtr) {
- new (dataPtr) return_type(binding(aotContext, argumentsPtr));
+ *static_cast<return_type *>(dataPtr) = binding(aotContext, argumentsPtr);
} else {
binding(aotContext, argumentsPtr);
}