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

QQuickWidget::setSource blocks on main thread

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.7.0, 6.8.0
    • None
    • WebAssembly

    Description

      Calling QQuickWidget::setSource on the WebAssembly target can sometimes hang.

      I suspect this may be due to it blocking on the main thread, as when setSource is called, it outputs:

      "Blocking on the main thread is very dangerous, see https://emscripten.org/docs/porting/pthreads.html#blocking-on-the-main-browser-thread"

      With the following stack trace:

      warnOnce    @    qml_block_main_thread.js:4039
      _emscripten_check_blocking_allowed    @    qml_block_main_thread.js:7870
      $__pthread_cond_timedwait    @    qml_block_main_thread.wasm:0x15f5436
      $pthread_cond_wait    @    qml_block_main_thread.wasm:0x15f5988
      $QWaitConditionPrivate::wait(QDeadlineTimer)    @    qml_block_main_thread.wasm:0x20e469
      $QWaitCondition::wait(QMutex*, QDeadlineTimer)    @    qml_block_main_thread.wasm:0x20e5fd
      $QQmlThread::internalCallMethodInThread(QQmlThread::Message*)    @    qml_block_main_thread.wasm:0x5bc763
      $QQmlTypeLoaderThread::loadWithCachedUnit(QQmlRefPointer<QQmlDataBlob> const&, QQmlPrivate::CachedQmlUnit const*)    @    qml_block_main_thread.wasm:0x5cfe75
      $void QQmlTypeLoader::doLoad<CachedLoader>(CachedLoader const&, QQmlDataBlob*, QQmlTypeLoader::Mode)    @    qml_block_main_thread.wasm:0x5bf157
      $QQmlTypeLoader::getType(QUrl const&, QQmlTypeLoader::Mode)    @    qml_block_main_thread.wasm:0x5c8370
      $QQmlComponentPrivate::loadUrl(QUrl const&, QQmlComponent::CompilationMode)    @    qml_block_main_thread.wasm:0x4c5387
      $QQmlComponent::QQmlComponent(QQmlEngine*, QUrl const&, QObject*)    @    qml_block_main_thread.wasm:0x4c5043
      $QQuickWidgetPrivate::execute()    @    qml_block_main_thread.wasm:0xbb95ba
      $QQuickWidget::setSource(QUrl const&)    @    qml_block_main_thread.wasm:0xbbb4d1
      $MainWindow::MainWindow(QWidget*) 

      This occurs with multithreaded version of Qt 6.7.0 and 6.8.0.

      Simple example program that should reproduce the error message is attached. (This simple example doesn't hang though.)

       

       

      Attachments

        Issue Links

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

          Activity

            People

              qt.webassembly qt.webassembly
              srcejon Jon Beniston
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes