I am trying to move some computation-intensive code to a worker thread, as recommended by Nokia documents. The basic outline of the code is something like this:

Code:
// Test.qml
import QtQuick 1.0
import com.meego 1.0

Page {
	id: page
	// ...

	WorkerScript {
		id: worker
		source: "Worker.js"
		onMessage: ...
	}

	DataModel {id : dataModel }

	function startWorker() {
		var msg = { page : page, test : 123, dataModel : dataModel };
		worker.sendMessage(msg);
        }
    }
}
//
With the javascript part like this
Code:
// in Worker.js
WorkerScript.onMessage = function(message) {	
	var obj = Qt.createQmlObject("QML code here", message.page, "myObject42");
	WorkerScript.sendMessage({ result: obj});
}
//
I have two problems with this code: first of all, the message from QML to JS is altered for some reason I dont understand. This is what I have in the calling QML:
DEBUG: page Test_QMLTYPE_44(0x1fbc4f68)
DEBUG: test 123
DEBUG: dataModel QDeclarativeListModel(0x1fbb8ac8)

And this is what the receiving JS code sees:
DEBUG: page null
DEBUG: test 123
DEBUG: dataModel QDeclarativeListModelWorkerAgent(name = "")

Notice that page is now NULL.


Second, the Qt component is not available in the JS code, resulting in this error:
TypeError: Result of expression 'Qt.createQmlObject' [undefined] is not a function
(no, this is not due to "page" being null, the result is the same of I use dataModel as parent)


Can anyone please tell me why this is happening?