Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
1.1.3
-
None
-
In Symbian ^3 emulator and device.
Description
Methods of QObject, returned by QServiceManager::loadInterface() method, can not be used from the other thread(via QMetaObject::invokeMethod method). Instead you can call methods of QObject object returned by QServiceManager::loadInterface() method if you create own wrapper object in same thread context wherein you call QServiceManager::loadInterface() method and call methods of Service framework(==QObject) via your wrapper instance.
In real use case you will encounter this problem if Qt Service framework is used from Symbian application.
This works:
void WorldClockClient::requestSelectionUi()
{
qDebug() << "Executing WorldClockClient::requestSelectionUi()....";
qDebug() << "WorldClockClient::requestSelectionUi() thread id: " << thread()->currentThreadId() ;
//This does not work.
//QMetaObject::invokeMethod(mService, "currentConfiguration",Qt::QueuedConnection);
//Client works if you comment out above line and remove comments away from below line.
QMetaObject::invokeMethod(mExecutor, "doWork", Qt::QueuedConnection);
}
This does not work:
void WorldClockClient::requestSelectionUi()
{
qDebug() << "Executing WorldClockClient::requestSelectionUi()....";
qDebug() << "WorldClockClient::requestSelectionUi() thread id: " << thread()->currentThreadId() ;
//This does not work.
QMetaObject::invokeMethod(mService, "currentConfiguration",Qt::QueuedConnection);
//Client works if you comment out above line and remove comments away from below line.
//QMetaObject::invokeMethod(mExecutor, "doWork", Qt::QueuedConnection);
}
Steps to reproduce problem:
1. Extract attached HelloWorld.zip to s60 environment.
2. Compile worldclock_service application and create sis file from it.
3. Compile worldclockclient dll.
4. Compile HelloWorld from HelloWorld\group directory using sbs -c armv5_urel command. Note: this is a Symbian application, not a Qt application.
5. Create sis file from HelloWorld app using HelloWorld\sis\HelloWorld.pkg file.
6. Install worldclock_service_template.sisx and HelloWorld.sisx packages to the device.
7. Start HelloWorld application and choose Options->Message menu.
8. Wait a couple seconds and then message box appears to the screen. Content of the message box is empty if you are using "QMetaObject::invokeMethod(mService, "currentConfiguration",Qt::QueuedConnection);" line in WorldClockClient::requestSelectionUi() method and content of the message box is "[MSG]:Pattijoki" if you are using "QMetaObject::invokeMethod(mExecutor, "doWork", Qt::QueuedConnection);" method call in WorldClockClient::requestSelectionUi() method. Note: for some reason in the latter case, "[MSG]:Pattijoki" text does not appear at the first attempt to the message box but it appears when you are choosing Options->Message menu second time and after that.