开发者

Why are seg faults happening when Qt is called from another thread?

I'm trying to use this api from a thread other than the 开发者_运维百科main OS thread QtMobility::QSystemDisplayInfo::colorDepth

crashes every time. Is there a way to make calls like this off the main thread?


In my experience with Qt on the desktop, anything that required the GUI or information from the underlying GUI subsystem (whether it was Windows, OS X, or X11) was best left to run on the main thread. As per the comment (and the linked SO question therein), you could attempt to instantiate a QtMobility::QSystemDisplayInfo object on the main thread first and use it in a worker thread. However, I've learned to stick with the "only do GUI stuff in the main thread" rule.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜