Details
Description
xCode 9 introduced a new tool which checks UI thread access: https://developer.apple.com/documentation/code_diagnostics/main_thread_checker.
When executing tests on a Qt project from xCode then the checker outputs several warnings like this:
================================================================= Main Thread Checker: UI API called on a background thread: -[UIView layer] PID: 28246, TID: 15743208, Thread name: QSGRenderThread, Queue name: com.apple.root.default-qos.overcommit, QoS: 0 Backtrace: 4 MyApp 0x000000010b389617 _ZNK10QIOSWindow9eaglLayerEv + 39 5 MyApp 0x000000010b3934c1 _ZNK11QIOSContext23needsRenderbufferResizeEP16QPlatformSurface + 145 6 MyApp 0x000000010b392d97 _ZN11QIOSContext11makeCurrentEP16QPlatformSurface + 567 7 MyApp 0x000000010b39380c _ZThn16_N11QIOSContext11makeCurrentEP16QPlatformSurface + 44 8 MyApp 0x000000010c442cea _ZN14QOpenGLContext11makeCurrentEP8QSurface + 458 9 MyApp 0x000000010c18e2af _ZN15QSGRenderThread3runEv + 399 10 MyApp 0x000000010cc995f4 _ZN14QThreadPrivate5startEPv + 900 11 libsystem_pthread.dylib 0x0000000116cb2661 _pthread_body + 340 12 libsystem_pthread.dylib 0x0000000116cb250d _pthread_body + 0 13 libsystem_pthread.dylib 0x0000000116cb1bf9 thread_start + 13 2018-11-07 10:53:53.562838+0100 MyApp[28246:15743208] [reports] Main Thread Checker: UI API called on a background thread: -[UIView layer] PID: 28246, TID: 15743208, Thread name: QSGRenderThread, Queue name: com.apple.root.default-qos.overcommit, QoS: 0 Backtrace: 4 MyApp 0x000000010b389617 _ZNK10QIOSWindow9eaglLayerEv + 39 5 MyApp 0x000000010b3934c1 _ZNK11QIOSContext23needsRenderbufferResizeEP16QPlatformSurface + 145 6 MyApp 0x000000010b392d97 _ZN11QIOSContext11makeCurrentEP16QPlatformSurface + 567 7 MyApp 0x000000010b39380c _ZThn16_N11QIOSContext11makeCurrentEP16QPlatformSurface + 44 8 MyApp 0x000000010c442cea _ZN14QOpenGLContext11makeCurrentEP8QSurface + 458 9 MyApp 0x000000010c18e2af _ZN15QSGRenderThread3runEv + 399 10 MyApp 0x000000010cc995f4 _ZN14QThreadPrivate5startEPv + 900 11 libsystem_pthread.dylib 0x0000000116cb2661 _pthread_body + 340 12 libsystem_pthread.dylib 0x0000000116cb250d _pthread_body + 0 13 libsystem_pthread.dylib 0x0000000116cb1bf9 thread_start + 13
Main Thread checker have already been disabled for the app target in : https://bugreports.qt.io/browse/QTBUG-63822 but it was not disabled for the test target .
By applying this patch to qtbase, this issue will be fixed :
patch.diff
Attachments
For Gerrit Dashboard: QTBUG-71636 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
245002,2 | macOS: Disable main thread checker for Xcode test target | 5.12 | qt/qtbase | Status: MERGED | +2 | 0 |