summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMilian Wolff <milian.wolff@kdab.com>2013-11-20 13:22:43 +0100
committerMilian Wolff <milian.wolff@kdab.com>2013-11-25 14:58:01 +0100
commitb2604fd7932f6bd73f06ca2ebf9e18ad542789d7 (patch)
tree8f27b954e09dbbd1d0de62d3cdc28ad58f2cf6bf /src
parent09d1bd8126c4eaaa572792ba223b49364805c205 (diff)
downloadqtwebchannel-b2604fd7932f6bd73f06ca2ebf9e18ad542789d7.tar.gz
Test QObject wrapping, when factory-style methods are called.
An HTML client can trigger the creation of new objects, or a published object on the server side might return other objects. These are then wrapped on the fly and can be used like the other objects. Note though that the HTML client can call deleteLater on these objects. Also, it does not yet work to wrap objects on the fly in signal arguments or property values. Change-Id: I92aa8a3e52f42d5325dd0771bbf9e2ae213e88f9 Reviewed-by: Arvid Nilsson <anilsson@blackberry.com> Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/qobject.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/qobject.js b/src/qobject.js
index cbff4f1..048295c 100644
--- a/src/qobject.js
+++ b/src/qobject.js
@@ -71,6 +71,12 @@ function QObject(name, data, webChannel)
qObject.destroyed.connect(function() {
if (webChannel.objectMap[objectId] === qObject) {
delete webChannel.objectMap[objectId];
+ // reset the now deleted QObject to an empty {} object
+ // just assigning {} though would not have the desired effect, but the
+ // below also ensures all external references will see the empty map
+ for (var prop in qObject) {
+ delete qObject[prop];
+ }
}
});
return qObject;