summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLutz Schönemann <lutz.schoenemann@basyskom.com>2014-08-06 13:38:00 +0200
committerLutz Schönemann <lutz.schoenemann@basyskom.com>2014-08-08 12:56:52 +0200
commit313db65d41c1a69053fd32a07ece1d8eca223916 (patch)
treec586fd264d6237f3dcd3447accaef87eb590c871 /src
parentcb01c71502898666d286e42c8e552b78b854fc2b (diff)
downloadqtwebchannel-313db65d41c1a69053fd32a07ece1d8eca223916.tar.gz
Call unwrapQObject for every response we get
The JS lib will miss to add QObjects to the local object descriptions when receiving a new description and the user has not registered a callback function. This patch makes the lib execute unwrapQObject for all responses received from a function call. Change-Id: I72d872d65a7e7bec1d7e6ffb1eea674d0f6e50d7 Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
Diffstat (limited to 'src')
-rw-r--r--src/webchannel/qwebchannel.js10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/webchannel/qwebchannel.js b/src/webchannel/qwebchannel.js
index 0fae276..2df8704 100644
--- a/src/webchannel/qwebchannel.js
+++ b/src/webchannel/qwebchannel.js
@@ -200,7 +200,8 @@ function QObject(name, data, webChannel)
function unwrapQObject( response )
{
- if (!response["__QObject*__"]
+ if (!response
+ || !response["__QObject*__"]
|| response["id"] === undefined
|| response["data"] === undefined) {
return response;
@@ -329,8 +330,11 @@ function QObject(name, data, webChannel)
"method": methodIdx,
"args": args
}, function(response) {
- if ( (response !== undefined) && callback ) {
- (callback)(unwrapQObject(response));
+ if (response !== undefined) {
+ var result = unwrapQObject(response);
+ if (callback) {
+ (callback)(result);
+ }
}
});
};