summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLutz Schönemann <lutz.schoenemann@basyskom.com>2014-07-24 17:31:22 +0200
committerMilian Wolff <milian.wolff@kdab.com>2014-08-03 16:58:30 +0200
commitaa75a39b3e3a4ae762f05b4a2e91d9790c8d5c88 (patch)
treedad0384c3199498b17b9bad8fe53ab83614f0819 /src
parent462d61dd29e4407005ccd679c417343cf5827726 (diff)
downloadqtwebchannel-aa75a39b3e3a4ae762f05b4a2e91d9790c8d5c88.tar.gz
Use UUIDs to identify wrapped objects
Instead of using stringified pointers to identify objects this patch creates UUIDs (version 4) for every object that get's wrapped by QMetaObjectPublisher Especially when using QtWebChannel to publish an interface to the network it comes to the point that you don't want to publish internal memory addresses Change-Id: I7e3fec7497d63572cfba72a5dacc10542aef415c Reviewed-by: Sumedha Widyadharma <sumedha.widyadharma@basyskom.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Milian Wolff <milian.wolff@kdab.com> Reviewed-by: Michael Bruning <michael.bruning@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/webchannel/qmetaobjectpublisher.cpp9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/webchannel/qmetaobjectpublisher.cpp b/src/webchannel/qmetaobjectpublisher.cpp
index 7c6c6eb..14b94f8 100644
--- a/src/webchannel/qmetaobjectpublisher.cpp
+++ b/src/webchannel/qmetaobjectpublisher.cpp
@@ -49,6 +49,7 @@
#include <QDebug>
#include <QJsonObject>
#include <QJsonArray>
+#include <QUuid>
#if HAVE_QML
#include <QtQml/QJSValue>
@@ -85,11 +86,6 @@ const QString KEY_ARGS = QStringLiteral("args");
const QString KEY_PROPERTY = QStringLiteral("property");
const QString KEY_VALUE = QStringLiteral("value");
-QString objectId(const QObject *object)
-{
- return QString::number(quintptr(object), 16);
-}
-
/// TODO: what is the proper value here?
const int PROPERTY_UPDATE_INTERVAL = 50;
}
@@ -442,8 +438,7 @@ QJsonValue QMetaObjectPublisher::wrapResult(const QVariant &result)
return objectInfo;
} // else the object is not yet wrapped, do it now
- const QString &id = objectId(object);
- Q_ASSERT(!registeredObjects.contains(id));
+ const QString &id = QUuid::createUuid().toString();
Q_ASSERT(!registeredObjectIds.contains(object));
objectInfo[KEY_QOBJECT] = true;