summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qobject.cpp
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2023-02-13 17:27:12 +0100
committerFabian Kosmale <fabian.kosmale@qt.io>2023-02-14 19:24:22 +0100
commit9483fcd68aef250c56a74556258dc80d9cc58220 (patch)
treeb472b721b9e44a3b1d06fe5a753edd214291022c /src/corelib/kernel/qobject.cpp
parentda5dc2062576b75b6427fcc2bc74dc4fcfd9dcf5 (diff)
QObject: Handle pointers to incomplete types in auto-connections
The code for the QMetaMethod queuedConnectionTypes overload relied on QMetaMethod::parameterMetaType and QMetaType::flags() to detect whether we're dealing with a pointer (and then use the VoidStar metatype instead). However, if the type was incomplete when the slot was defined, and the type was not registered when connect was called, we would not find a metatype for the argument. However, in that case we might still be able to handle the method, by checking whether the type name of the arguments ends with a "*". This patch does that, fixing a regression from 5.15. Pick-to: 6.5 6.4 6.2 Fixes: QTBUG-108537 Change-Id: I54cc48a3343444480ab9094fe1ebaaa5aa75cee0 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/corelib/kernel/qobject.cpp')
-rw-r--r--src/corelib/kernel/qobject.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index 829cd4c79f2..c49a65136ae 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -84,6 +84,8 @@ static int *queuedConnectionTypes(const QMetaMethod &method)
typeIds[i] = QMetaType::VoidStar;
else
typeIds[i] = metaType.id();
+ if (!typeIds[i] && method.parameterTypeName(i).endsWith('*'))
+ typeIds[i] = QMetaType::VoidStar;
if (!typeIds[i]) {
const QByteArray typeName = method.parameterTypeName(i);
qCWarning(lcConnect,