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

Windows Debug: QQuickWebEngineScriptCollection crashes after adding custom library path

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P1: Critical P1: Critical
    • 6.8.5, 6.9.3, 6.10.0 Beta4, 6.11.0 FF
    • 6.8.1
    • WebEngine
    • None
    • - OS: Windows 10 22h2
      - Qt Version: 6.8.1
      - Compiler: MSVC 17 (VS2022)
      - Build Type: Debug (release builds unaffected)
      - Architecture: x64
    • Windows
    • b02b9fb43 (dev), 90c35756d (6.10), 8523b4feb (6.9), 88ae008e2 (6.8), 9e613024b (tqtc/lts-6.8)

      Summary

      QQuickWebEngineScriptCollection crashes with assertion "engine" when accessing userScripts.collection after adding a custom library path via QCoreApplication::addLibraryPath - Windows debug builds only

      Steps to Reproduce

      1. Call `QCoreApplication::addLibraryPath()` to add a custom library path
      2. Register a C++ singleton type exposing a `QQuickWebEngineProfile*` property via `qmlRegisterSingletonType`
      3. Load QML (QQuickView::setSource) that accesses the `userScripts.collection` property of the WebEngineView profile

      Expected outcome

      The application should load normally and allow access to the userScripts collection without crashing.

      Result

      Application crashes with assertion failure: "engine" in `c:\qt\6.8.1\Src\qtwebengine\src\webenginequick\api\qquickwebenginescriptcollection.cpp:242`

      Additional Details

      • Crash occurs ONLY when custom library path is added AND only in Windows debug builds
      • Release builds work fine
      • macOS builds (debug and release) work fine

      Minimal implementation

      singleton

      class Model : public QObject
      {
          Q_OBJECT
      public:
          Q_INVOKABLE QQuickWebEngineProfile* profile() { return mProfile; }
      private:
          QQuickWebEngineProfile* mProfile;
      }; 

       

      qml

      import QtQuick
      import QtWebChannel
      import QtWebEngine
      WebEngineView {
          id: webView
          Component.onCompleted: {
              var qtWebChannelScript = WebEngine.script()
              var setHooksScript = WebEngine.script()
              
              webView.profile.userScripts.collection = [ qtWebChannelScript, setHooksScript ]
          }
      } 

      Crash Stack Trace

      >    Qt6Cored.dll!qAbort() Line 38    C++
           Qt6Cored.dll!qt_message_fatal<QString &>(QtMsgType __formal, const QMessageLogContext & context, QString & message) Line 2117    C++
           Qt6Cored.dll!qt_message(QtMsgType msgType, const QMessageLogContext & context, const char * msg, char * ap) Line 382    C++
           Qt6Cored.dll!QMessageLogger::fatal(const char * msg, ...) Line 885    C++
           Qt6Cored.dll!qt_assert(const char * assertion, const char * file, int line) Line 104    C++
           Qt6WebEngineQuickd.dll!QQuickWebEngineScriptCollection::setQmlEngine(QQmlEngine * engine) Line 243    C++
           Qt6WebEngineQuickd.dll!QQuickWebEngineProfilePrivate::getUserScripts() Line 339    C++
           Qt6WebEngineQuickd.dll!QQuickWebEngineProfile::userScripts() Line 1120    C++
           Qt6WebEngineQuickd.dll!QQuickWebEngineProfile::qt_static_metacall(QObject * _o, QMetaObject::Call _c, int _id, void * * _a) Line 535    C++
           Qt6Qmld.dll!QQmlPropertyData::readPropertyWithArgs(QObject * target, void * * args) Line 375    C++
           Qt6Qmld.dll!QQmlPropertyData::readProperty(QObject * target, void * property) Line 359    C++
           Qt6Qmld.dll!QV4::loadProperty(QV4::ExecutionEngine * v4, QV4::Heap::Object * wrapper, QObject * object, const QQmlPropertyData & property) Line 123    C++
           Qt6Qmld.dll!QV4::QObjectWrapper::getProperty(QV4::ExecutionEngine * engine, QV4::Heap::Object * wrapper, QObject * object, const QQmlPropertyData * property, QFlags<enum QV4::QObjectWrapper::Flag> flags) Line 377    C++
           Qt6Qmld.dll!QV4::QObjectWrapper::lookupPropertyGetterImpl<`QV4::Lookup::getterQObject'::`2'::<lambda_1>>(QV4::Lookup * lookup, QV4::ExecutionEngine * engine, const QV4::Value & object, QFlags<enum QV4::QObjectWrapper::Flag> flags, QV4::Lookup::getterQObject::__l2::<lambda_1> revertLookup) Line 311    C++
           Qt6Qmld.dll!QV4::Lookup::getterQObject(QV4::Lookup * lookup, QV4::ExecutionEngine * engine, const QV4::Value & object) Line 420    C++
           Qt6Qmld.dll!QV4::QObjectWrapper::virtualResolveLookupGetter(const QV4::Object * object, QV4::ExecutionEngine * engine, QV4::Lookup * lookup) Line 1135    C++
           Qt6Qmld.dll!QV4::Object::resolveLookupGetter(QV4::ExecutionEngine * engine, QV4::Lookup * lookup) Line 342    C++
           Qt6Qmld.dll!QV4::Lookup::resolveGetter(QV4::ExecutionEngine * engine, const QV4::Object * object) Line 39    C++
           Qt6Qmld.dll!QV4::Lookup::getterGeneric(QV4::Lookup * l, QV4::ExecutionEngine * engine, const QV4::Value & object) Line 115    C++
           Qt6Qmld.dll!QV4::Moth::VME::interpret(QV4::JSTypesStackFrame * frame, QV4::ExecutionEngine * engine, const char * code) Line 674    C++
           Qt6Qmld.dll!QV4::Moth::VME::exec(QV4::JSTypesStackFrame * frame, QV4::ExecutionEngine * engine) Line 487    C++
           Qt6Qmld.dll!QV4::doCall(QV4::Function * self, const QV4::Value * thisObject, const QV4::Value * argv, int argc, QV4::ExecutionContext * context) Line 52    C++
           Qt6Qmld.dll!QV4::Function::call(const QV4::Value * thisObject, const QV4::Value * argv, int argc, QV4::ExecutionContext * context) Line 78    C++
           Qt6Qmld.dll!QV4::Function::call::__l5::<lambda_1>::operator()(const QV4::Value * thisObject, const QV4::Value * argv, int argc) Line 29    C++
           Qt6Qmld.dll!QV4::convertAndCall<`QV4::Function::call'::`5'::<lambda_1>>(QV4::ExecutionEngine * engine, QObject * thisObject, void * * a, const QMetaType * types, int argc, QV4::Function::call::__l5::<lambda_1> call) Line 199    C++
           Qt6Qmld.dll!QV4::Function::call(QObject * thisObject, void * * a, const QMetaType * types, int argc, QV4::ExecutionContext * context) Line 25    C++
           Qt6Qmld.dll!QQmlJavaScriptExpression::evaluate(void * * a, const QMetaType * types, int argc) Line 270    C++
           Qt6Qmld.dll!QQmlBoundSignalExpression::evaluate(void * * a) Line 203    C++
           Qt6Qmld.dll!QQmlBoundSignal_callback(QQmlNotifierEndpoint * e, void * * a) Line 316    C++
           Qt6Qmld.dll!QQmlNotifier::emitNotify(QQmlNotifierEndpoint * endpoint, void * * a) Line 71    C++
           Qt6Qmld.dll!QQmlData::signalEmitted(QAbstractDeclarativeData * __formal, QObject * object, int index, void * * a) Line 342    C++
           Qt6Cored.dll!doActivate<0>(QObject * sender, int signal_index, void * * argv) Line 4018    C++
           Qt6Cored.dll!QMetaObject::activate(QObject * sender, const QMetaObject * m, int local_signal_index, void * * argv) Line 4185    C++
           Qt6Qmld.dll!QQmlComponentAttached::completed() Line 155    C++
           Qt6Qmld.dll!QQmlObjectCreator::finalize(QQmlInstantiationInterrupt & interrupt) Line 1606    C++
           Qt6Qmld.dll!QQmlComponentPrivate::complete(QQmlEnginePrivate * enginePriv, QQmlComponentPrivate::ConstructionState * state) Line 1190    C++
           Qt6Qmld.dll!QQmlComponentPrivate::completeCreate() Line 1305    C++
           Qt6Qmld.dll!QQmlComponent::completeCreate() Line 1272    C++
           Qt6Qmld.dll!QQmlComponentPrivate::createWithProperties(QObject * parent, const QMap<QString,QVariant> & properties, QQmlContext * context, QQmlComponentPrivate::CreateBehavior behavior, bool createFromQml) Line 973    C++
           Qt6Qmld.dll!QQmlComponent::create(QQmlContext * context) Line 916    C++
           Qt6Quickd.dll!QQuickView::continueExecute() Line 513    C++
           Qt6Quickd.dll!QQuickViewPrivate::execute() Line 76    C++
           Qt6Quickd.dll!QQuickView::setSource(const QUrl & url) Line 239    C++
             

        1. bug138881.diff
          0.7 kB
          Allan Sandfeld Jensen
        For Gerrit Dashboard: QTBUG-138881
        # Subject Branch Project Status CR V

            allan.jensen Allan Sandfeld Jensen
            marc.palet Marc Palet Gual
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes