summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2020-05-14 21:06:39 +0200
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2020-05-14 21:06:39 +0200
commit2398037151babcb817c94463fc240c7694f73d4c (patch)
tree7ba502f85a57a3aedceb893f379e6a5436f680e7 /src
parent8554d71f47f85b111f095ea8f25c3a72c5cae32e (diff)
parent3342da908955187a4543cdc38e0fad2e78e936e7 (diff)
downloadqtwebchannel-2398037151babcb817c94463fc240c7694f73d4c.tar.gz
Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: I6417958acf66455b993c65f51b58f15955aa95f4
Diffstat (limited to 'src')
-rw-r--r--src/webchannel/qmetaobjectpublisher.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/webchannel/qmetaobjectpublisher.cpp b/src/webchannel/qmetaobjectpublisher.cpp
index c0a12dc..f6110ed 100644
--- a/src/webchannel/qmetaobjectpublisher.cpp
+++ b/src/webchannel/qmetaobjectpublisher.cpp
@@ -827,10 +827,19 @@ QJsonValue QMetaObjectPublisher::wrapResult(const QVariant &result, QWebChannelA
// *don't* use result.toList() as that *only* works for QVariantList and QStringList!
// Also, don't use QSequentialIterable (yet), since that seems to trigger QTBUG-42016
// in certain cases.
- return wrapList(result.value<QVariantList>(), transport);
+ // additionally, when there's a direct converter to QVariantList, use that one via convert
+ // but recover when conversion fails and fall back to the .value<QVariantList> conversion
+ // see also: https://bugreports.qt.io/browse/QTBUG-80751
+ auto list = result;
+ if (!list.convert(qMetaTypeId<QVariantList>()))
+ list = result;
+ return wrapList(list.value<QVariantList>(), transport);
} else if (result.canConvert<QVariantMap>()) {
// recurse and potentially wrap contents of the map
- return wrapMap(result.toMap(), transport);
+ auto map = result;
+ if (!map.convert(qMetaTypeId<QVariantMap>()))
+ map = result;
+ return wrapMap(map.value<QVariantMap>(), transport);
}
return QJsonValue::fromVariant(result);