开发者

Qt - Mysterious segfaults on worker thread

I'm instantiating QSystemDeviceInfo on a worker thread, but it causes a segfault.

int BatteryInfo::getLevel() {
   QSystemDeviceInfo sysDevInfo; //segfault happens when I step on to this line
   return 开发者_JS百科sysDevInfo.batteryLevel();
}

Is the class thread-safe, or does the problem lie elsewhere?

EDIT: With further debugging I also noticed that native Symbian calls segfault as well.

Best regards


Me and my friend found this issue as well on Symbian Qt Mobilty 1.0. He reported an issue QtMobility access from multiple threads. As it says in the issue description Think this could be due to that some static members are created first time the QSystemDeviceInfo/QSystemNetworkInfo is created..

If you are using Qt Mobility 1.2 or only accessing QSystemDeviceInfo from one thread it's some other issue.

EDIT: One workaround for us was to make sure we created a QSystemDeviceInfo object in our main thread first but then we had some problems with not getting all signals.


Do you have capabilities set ? QSystemDeviceInfo needs the 'ReadDeviceData' capability.You will need to sign your app to install on the device if you include this capability.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜