Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-118421

TextField logs "Cannot create children for a parent that is in a different thread" when closing virtual keyboard

XMLWordPrintable

    • Android
    • d48e81f7a (dev), 37c29fca7 (6.6), 8d7476494 (tqtc/lts-6.5)
    • 2023wk46FOQtforAndroid, 2023wk48FOQtforAndroid

      This happens in a CMake project using Qt 6.5 (6.5.2 was what I used for this) and an application that uses a QML module on Android.

      In the QML module, when a TextField is interacted with and the user taps the "Ok" or "Return" button on the virtual keyboard, the application will log the following:

      W libappqml_module_test_x86.so: QObject: Cannot create children for a parent that is in a different thread.
      W libappqml_module_test_x86.so: (Parent is QGuiApplication(0xc4f9a208), parent's thread is QThread(0xf3b35cf0), current thread is QThread(0xf3b1e6d0) 

      I managed to reproduce this using a very bare-bones project to figure out that it might be an issue within Qt and not within the project I first encountered this, but I can't rule out that I misconfigured the project in CMake, of course.

       

      You can find the test project attached to this issue. It should deploy to an Android target with no further changes. Follow the on-screen instructions to reproduce this issue.

      I was not able to reproduce the issue on iOS. Here's the logs:

      QML debugging is enabled. Only use this in a safe environment.
      2023-10-26 11:53:05.037659+0200 appqml_module_test[527:13682] Metal GPU Frame Capture Enabled
      2023-10-26 11:53:05.037774+0200 appqml_module_test[527:13682] Metal API Validation Enabled
      2023-10-26 11:53:05.522282+0200 appqml_module_test[527:13682] stale focus object 0x0 , doing manual update
      =================================================================
      Main Thread Checker: UI API called on a background thread: -[UIView contentScaleFactor]
      PID: 527, TID: 14016, Thread name: QSGRenderThread, Queue name: com.apple.root.default-qos.overcommit, QoS: 0
      Backtrace:
      4   appqml_module_test                  0x00000001056c6848 _ZNK10QIOSWindow16devicePixelRatioEv + 36
      5   appqml_module_test                  0x00000001067a8184 _ZNK7QWindow16devicePixelRatioEv + 88
      6   appqml_module_test                  0x0000000105b396b4 _ZNK12QQuickWindow25effectiveDevicePixelRatioEv + 128
      7   appqml_module_test                  0x0000000105b39f50 _ZN19QQuickWindowPrivate14syncSceneGraphEv + 148
      8   appqml_module_test                  0x0000000105e8f964 _ZN15QSGRenderThread4syncEb + 440
      9   appqml_module_test                  0x0000000105e90518 _ZN15QSGRenderThread13syncAndRenderEv + 2108
      10  appqml_module_test                  0x0000000105e91804 _ZN15QSGRenderThread3runEv + 292
      11  appqml_module_test                  0x00000001049fb1b0 _ZZN14QThreadPrivate5startEPvENK3$_0clEv + 636
      12  appqml_module_test                  0x00000001049f9b78 _ZN12_GLOBAL__N_122terminate_on_exceptionIZN14QThreadPrivate5startEPvE3$_0EEvOT_ + 28
      13  appqml_module_test                  0x00000001049f9b08 _ZN14QThreadPrivate5startEPv + 108
      14  libsystem_pthread.dylib             0x0000000225a7a6b8 _pthread_start + 148
      15  libsystem_pthread.dylib             0x0000000225a79b88 thread_start + 8
      2023-10-26 11:53:05.672149+0200 appqml_module_test[527:14016] [reports] Main Thread Checker: UI API called on a background thread: -[UIView contentScaleFactor]
      PID: 527, TID: 14016, Thread name: QSGRenderThread, Queue name: com.apple.root.default-qos.overcommit, QoS: 0
      Backtrace:
      4   appqml_module_test                  0x00000001056c6848 _ZNK10QIOSWindow16devicePixelRatioEv + 36
      5   appqml_module_test                  0x00000001067a8184 _ZNK7QWindow16devicePixelRatioEv + 88
      6   appqml_module_test                  0x0000000105b396b4 _ZNK12QQuickWindow25effectiveDevicePixelRatioEv + 128
      7   appqml_module_test                  0x0000000105b39f50 _ZN19QQuickWindowPrivate14syncSceneGraphEv + 148
      8   appqml_module_test                  0x0000000105e8f964 _ZN15QSGRenderThread4syncEb + 440
      9   appqml_module_test                  0x0000000105e90518 _ZN15QSGRenderThread13syncAndRenderEv + 2108
      10  appqml_module_test                  0x0000000105e91804 _ZN15QSGRenderThread3runEv + 292
      11  appqml_module_test                  0x00000001049fb1b0 _ZZN14QThreadPrivate5startEPvENK3$_0clEv + 636
      12  appqml_module_test                  0x00000001049f9b78 _ZN12_GLOBAL__N_122terminate_on_exceptionIZN14QThreadPrivate5startEPvE3$_0EEvOT_ + 28
      13  appqml_module_test                  0x00000001049f9b08 _ZN14QThreadPrivate5startEPv + 108
      14  libsystem_pthread.dylib             0x0000000225a7a6b8 _pthread_start + 148
      15  libsystem_pthread.dylib             0x0000000225a79b88 thread_start + 8
      2023-10-26 11:53:11.973202+0200 appqml_module_test[527:13682] stale focus object 0x283b3d360 , doing manual update
      2023-10-26 11:53:11.973672+0200 appqml_module_test[527:13682] QPlatformInputContext::inputMethodAccepted() does not match actual focus object IM enablement!
      2023-10-26 11:53:12.092528+0200 appqml_module_test[527:13682] Successfully load keyboard extensions
      2023-10-26 11:53:12.155044+0200 appqml_module_test[527:14008] [lifecycle] [u 6ACACC73-5325-4D0D-AC98-F2F6C56C237C:m (null)] [com.google.keyboard.KeyboardExtension(2.3.19)] RB query for the extension process state failed with error: Error Domain=RBSServiceErrorDomain Code=1 "Client not entitled" UserInfo={RBSEntitlement=com.apple.runningboard.process-state, NSLocalizedFailureReason=Client not entitled, RBSPermanent=false}
      2023-10-26 11:53:13.670416+0200 appqml_module_test[527:13682] stale focus object 0x28025c540 , doing manual update
      2023-10-26 11:53:13.670753+0200 appqml_module_test[527:13682] QPlatformInputContext::inputMethodAccepted() does not match actual focus object IM enablement!
      2023-10-26 11:53:15.790913+0200 appqml_module_test[527:13682] stale focus object 0x283b3d360 , doing manual update
      2023-10-26 11:53:15.791347+0200 appqml_module_test[527:13682] QPlatformInputContext::inputMethodAccepted() does not match actual focus object IM enablement!
      2023-10-26 11:53:16.427533+0200 appqml_module_test[527:13682] stale focus object 0x28025c540 , doing manual update
      2023-10-26 11:53:16.427737+0200 appqml_module_test[527:13682] QPlatformInputContext::inputMethodAccepted() does not match actual focus object IM enablement!
      2023-10-26 11:53:17.191262+0200 appqml_module_test[527:13682] stale focus object 0x283b3d360 , doing manual update
      2023-10-26 11:53:17.191734+0200 appqml_module_test[527:13682] QPlatformInputContext::inputMethodAccepted() does not match actual focus object IM enablement!
      2023-10-26 11:53:17.874456+0200 appqml_module_test[527:13682] stale focus object 0x28025c540 , doing manual update
      2023-10-26 11:53:17.874769+0200 appqml_module_test[527:13682] QPlatformInputContext::inputMethodAccepted() does not match actual focus object IM enablement! 

      The "stale focus" followed by "QPlatformInputContext" messages are triggered every time the enter/done key is tapped. But they have been around for longer, if I recall correctly.

      I was not able to get anything meaningful from testing it on Windows, there don't seem to be issues on other platforms.

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            assam Assam Boudjelthia
            lugotal Lukas Gottschald
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes