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

Quick WebEngineView crashes when access url property too early

    XMLWordPrintable

Details

    • Linux/X11
    • a5e680c2ef404693870aedfb10f22ffc83cd38e7

    Description

      Binding WebEngineView property may result crash.
      See the attached example: main.qml

      Backtrace:

      Thread 1 "bug-adapter" received signal SIGSEGV, Segmentation fault.
      QtWebEngineCore::WebContentsAdapter::isInitialized (this=this@entry=0x0) at /home/stampho/work/Qt/qt5-512-src/qtwebengine/src/core/web_contents_adapter.cpp:428
      428	    return (bool)m_webContentsDelegate;
      (gdb) bt
      #0  QtWebEngineCore::WebContentsAdapter::isInitialized (this=this@entry=0x0) at /home/stampho/work/Qt/qt5-512-src/qtwebengine/src/core/web_contents_adapter.cpp:428
      #1  0x00007f19ecc3afd3 in QtWebEngineCore::WebContentsAdapter::activeUrl (this=0x0) at /home/stampho/work/Qt/qt5-512-src/qtwebengine/src/core/web_contents_adapter.cpp:698
      #2  0x00007f19fbb26cba in QQuickWebEngineView::url (this=this@entry=0x4c1210)
          at /home/stampho/work/Qt/qt5-512-dev/qtbase/include/QtCore/../../../../qt5-512-src/qtbase/src/corelib/tools/qsharedpointer_impl.h:312
      #3  0x00007f19fbb40408 in QQuickWebEngineView::qt_static_metacall (_o=0x4c1210, _c=<optimized out>, _id=<optimized out>, _a=<optimized out>)
          at .moc/moc_qquickwebengineview_p.cpp:1591
      #4  0x00007f19eaceb33f in QQmlPropertyData::readPropertyWithArgs (this=this@entry=0x7f19d00627a8, target=target@entry=0x4c1210, args=args@entry=0x7fffffffd1b0)
          at /home/stampho/work/Qt/qt5-512-dev/qtbase/include/QtQml/5.12.0/QtQml/private/../../../../../../../qt5-512-src/qtdeclarative/src/qml/qml/qqmlpropertycache_p.h:334
      #5  0x00007f19eace51bb in QQmlPropertyData::readProperty (property=<optimized out>, target=0x4c1210, this=0x7f19d00627a8)
          at /home/stampho/work/Qt/qt5-512-dev/qtbase/include/QtQml/5.12.0/QtQml/private/../../../../../../../qt5-512-src/qtdeclarative/src/qml/qml/qqmlpropertycache_p.h:328
      #6  loadProperty (v4=v4@entry=0x477de0, object=object@entry=0x4c1210, property=...) at /home/stampho/work/Qt/qt5-512-src/qtdeclarative/src/qml/jsruntime/qv4qobjectwrapper.cpp:204
      #7  0x00007f19eace7e3e in QV4::QObjectWrapper::getProperty (engine=engine@entry=0x477de0, object=0x4c1210, property=property@entry=0x7f19d00627a8, 
          captureRequired=captureRequired@entry=true) at /home/stampho/work/Qt/qt5-512-src/qtdeclarative/src/qml/jsruntime/qv4qobjectwrapper.cpp:268
      #8  0x00007f19eace8c44 in QV4::QObjectWrapper::getQmlProperty (this=this@entry=0x7f19ddf59530, qmlContext=0x4958f0, name=0x7f19ddf59538, 
          revisionMode=revisionMode@entry=QV4::QObjectWrapper::IgnoreRevision, hasProperty=hasProperty@entry=0x0, includeImports=includeImports@entry=true)
          at /usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/include/g++-v8/bits/atomic_base.h:390
      #9  0x00007f19eace8f62 in QV4::QObjectWrapper::virtualGet (m=m@entry=0x7f19ddf59530, id=..., receiver=receiver@entry=0x7f19ddf59530, hasProperty=hasProperty@entry=0x0)
          at /home/stampho/work/Qt/qt5-512-dev/qtbase/include/QtQml/5.12.0/QtQml/private/../../../../../../../qt5-512-src/qtdeclarative/src/qml/jsruntime/qv4value_p.h:382
      #10 0x00007f19ead7c97d in QV4::Object::get (receiver=0x7f19ddf59530, hasProperty=0x0, name=0x7f19ddf59528, this=0x7f19ddf59530)
          at /home/stampho/work/Qt/qt5-512-dev/qtbase/include/QtQml/5.12.0/QtQml/private/../../../../../../../qt5-512-src/qtdeclarative/src/qml/memory/qv4heap_p.h:82
      #11 QV4::Runtime::method_loadProperty (engine=engine@entry=0x477de0, object=..., nameIndex=<optimized out>)
          at /home/stampho/work/Qt/qt5-512-src/qtdeclarative/src/qml/jsruntime/qv4runtime.cpp:854
      #12 0x00007f19eacfb88f in QV4::Moth::VME::interpret (frame=frame@entry=0x7fffffffd570, engine=engine@entry=0x477de0, code=0x7f19fba1015a "\030\006\002")
          at /home/stampho/work/Qt/qt5-512-src/qtdeclarative/src/qml/jsruntime/qv4vme_moth.cpp:589
      #13 0x00007f19ead01b7f in QV4::Moth::VME::exec (frame=frame@entry=0x7fffffffd570, engine=engine@entry=0x477de0)
          at /home/stampho/work/Qt/qt5-512-src/qtdeclarative/src/qml/jsruntime/qv4vme_moth.cpp:441
      #14 0x00007f19eac7e61a in QV4::Function::call (this=this@entry=0x4b2910, thisObject=thisObject@entry=0x7f19ddf59498, argv=argv@entry=0x7f19ddf594b0, argc=<optimized out>, 
          context=<optimized out>) at /home/stampho/work/Qt/qt5-512-src/qtdeclarative/src/qml/jsruntime/qv4function.cpp:68
      #15 0x00007f19eae255f9 in QQmlJavaScriptExpression::evaluate (this=this@entry=0x56fc90, callData=callData@entry=0x7f19ddf59480, isUndefined=isUndefined@entry=0x7fffffffd75f)
          at /home/stampho/work/Qt/qt5-512-dev/qtbase/include/QtQml/5.12.0/QtQml/private/../../../../../../../qt5-512-src/qtdeclarative/src/qml/jsruntime/qv4value_p.h:178
      #16 0x00007f19eae2b434 in QQmlBinding::evaluate (this=this@entry=0x56fc90, isUndefined=isUndefined@entry=0x7fffffffd75f)
          at /home/stampho/work/Qt/qt5-512-dev/qtbase/include/QtQml/5.12.0/QtQml/private/../../../../../../../qt5-512-src/qtdeclarative/src/qml/jsruntime/qv4jscall_p.h:94
      #17 0x00007f19eae3246d in QQmlNonbindingBinding::doUpdate (this=0x56fc90, watcher=..., flags=..., scope=...)
          at /home/stampho/work/Qt/qt5-512-src/qtdeclarative/src/qml/qml/qqmlbinding.cpp:245
      #18 0x00007f19eae2ed90 in QQmlBinding::update (this=this@entry=0x56fc90, flags=flags@entry=...) at /home/stampho/work/Qt/qt5-512-src/qtdeclarative/src/qml/qml/qqmlbinding.cpp:185
      #19 0x00007f19eae2fcb8 in QQmlBinding::setEnabled (this=0x56fc90, e=<optimized out>, flags=...) at /home/stampho/work/Qt/qt5-512-src/qtdeclarative/src/qml/qml/qqmlbinding.cpp:550
      #20 0x00007f19eae41008 in QQmlObjectCreator::finalize (this=0x495780, interrupt=...)
          at /home/stampho/work/Qt/qt5-512-dev/qtbase/include/QtCore/../../../../qt5-512-src/qtbase/src/corelib/tools/qshareddata.h:158
      #21 0x00007f19eadb6b69 in QQmlComponentPrivate::complete (enginePriv=0x477820, state=state@entry=0x4b30a0)
          at /home/stampho/work/Qt/qt5-512-dev/qtbase/include/QtCore/../../../../qt5-512-src/qtbase/src/corelib/tools/qscopedpointer.h:116
      #22 0x00007f19eadb6c8f in QQmlComponentPrivate::completeCreate (this=0x4b3000) at /home/stampho/work/Qt/qt5-512-src/qtdeclarative/src/qml/qml/qqmlcomponent.cpp:961
      #23 0x00007f19eadb6d13 in QQmlComponent::completeCreate (this=<optimized out>) at /home/stampho/work/Qt/qt5-512-src/qtdeclarative/src/qml/qml/qqmlcomponent.cpp:953
      #24 0x00007f19eadb696f in QQmlComponent::create (this=0x4b2c00, context=<optimized out>) at /home/stampho/work/Qt/qt5-512-src/qtdeclarative/src/qml/qml/qqmlcomponent.cpp:787
      #25 0x00007f19eae34262 in QQmlApplicationEnginePrivate::finishLoad (this=this@entry=0x477820, c=c@entry=0x4b2c00)
          at /home/stampho/work/Qt/qt5-512-src/qtdeclarative/src/qml/qml/qqmlapplicationengine.cpp:134
      #26 0x00007f19eae344e6 in QQmlApplicationEnginePrivate::startLoad (this=0x477820, url=..., data=..., dataFlag=dataFlag@entry=false)
          at /home/stampho/work/Qt/qt5-512-src/qtdeclarative/src/qml/qml/qqmlapplicationengine.cpp:118
      #27 0x00007f19eae3451e in QQmlApplicationEngine::load (this=<optimized out>, url=...)
          at /home/stampho/work/Qt/qt5-512-dev/qtbase/include/QtCore/../../../../qt5-512-src/qtbase/src/corelib/tools/qarraydata.h:257
      #28 0x0000000000401355 in main (argc=1, argv=0x7fffffffdcd8) at ../bug-adapter/main.cpp:11
      

      Since https://codereview.qt-project.org/#/c/235944/6 WebContentsAdapter is initialized together with the Profile. It should be initialized with the WebEngineView or to be checked if nullptr for each property that uses adapter.

      Attachments

        1. minimal_main_qml.diff
          0.5 kB
        2. main.qml
          0.2 kB

        Issue Links

          For Gerrit Dashboard: QTBUG-70248
          # Subject Branch Project Status CR V

          Activity

            People

              michal Michal Klocek
              pvarga Peter Varga
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes