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

Loader setSource with property binding crashes

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 5.11.2
    • 5.11.0
    • None
    • Windows 7/10 with Visual Studio 2017
      MacOS
    • e023a338c4f30e43f4b2ae4a916e4051123d41dd

    Description

      When setting property with binding via setSource() and asynchronous: true a crash occurs.

      In Version 5.10.1 and earlier this works

       

      import QtQuick 2.11
      import QtQuick.Window 2.11
      import QtQuick.Controls 2.2
      
      Window {
          id: root
          visible: true
          width: 640
          height: 480
      
          property bool showFullscreen: false
      
          Button {
              anchors.centerIn: parent
              onClicked: loader.load()
              text: "Load"
          }
      
          Loader {
              id: loader
              anchors.fill: parent
              asynchronous: true // crash when setSource sets a property with binding
              function load() {
                  if(item === null) {
                        setSource("TestItem.qml",  {"showFullscreen": Qt.binding(function(){return root.showFullscreen })} ); // crash with 5.11.0 and asynchronous=true
                        //setSource("TestItem.qml",  {"showFullscreen": false} ); // works 
                  }
              }
          }
      }
      

       

       TestItem.qml

      Rectangle {
          color: "blue"
          property bool showFullscreen: false
      }
      

       

      Stacktrace:

      Exception thrown: read access violation.
      this->** v4Function** was nullptr.
      
      Qt5Qmld.dll !QV4::CppStackFrame::lineNumber() Line 786   
      Qt5Qmld.dll !QV4::QQmlBindingFunction::currentLocation() Line 1358   
      Qt5Qmld.dll !QV4::QObjectWrapper::setProperty(QV4::ExecutionEngine* engine, QObject * object, QQmlPropertyData * property, const QV4::Value& value) Line 466   
      Qt5Qmld.dll !QV4::QObjectWrapper::setQmlProperty(QV4::ExecutionEngine* engine, QQmlContextData * qmlContext, QObject * object, QV4::String* name, QV4::QObjectWrapper::RevisionMode revisionMode, const QV4::Value& value) Line 430   
      Qt5Qmld.dll !QV4::QObjectWrapper::put(QV4::Managed* m, QV4::String* name, const QV4::Value& value) Line 706   
      Qt5Qmld.dll !QV4::Object::put(QV4::String* name, const QV4::Value& v) Line 370 
      Qt5Qmld.dll !QQmlComponentPrivate::setInitialProperties(QV4::ExecutionEngine* engine, QV4::QmlContext* qmlContext, const QV4::Value& o, const QV4::Value& v) Line 1256   
      Qt5Qmld.dll !QQmlComponentPrivate::initializeObjectWithInitialProperties(QV4::QmlContext* qmlContext, const QV4::Value& valuemap, QObject * toCreate) Line 1454    
      Qt5Quickd.dll !QQuickLoaderPrivate::setInitialState(QObject * obj) Line 670  
      Qt5Quickd.dll !QQuickLoaderIncubator::setInitialState(QObject * o) Line 635  
      Qt5Qmld.dll !QQmlIncubatorPrivate::incubate(QQmlInstantiationInterrupt & i) Line 321 
      Qt5Qmld.dll !QQmlIncubationController::incubateFor(int msecs) Line 390   
      Qt5Quickd.dll !QQuickWindowIncubationController::incubate() Line 161 
      Qt5Quickd.dll !QQuickWindowIncubationController::timerEvent(QTimerEvent * __formal) Line 144 
      Qt5Cored.dll !QObject::event(QEvent * e) Line 1233   
      Qt5Cored.dll !QCoreApplicationPrivate::notify_helper(QObject * receiver, QEvent * event) Line 1198   
      Qt5Cored.dll !doNotify(QObject * receiver, QEvent * event) Line 1138 
      Qt5Cored.dll !QCoreApplication::notify(QObject * receiver, QEvent * event) Line 1125 
      Qt5Guid.dll !QGuiApplication::notify(QObject * object, QEvent * event) Line 1760 
      Qt5Cored.dll !QCoreApplication::notifyInternal2(QObject * receiver, QEvent * event) Line 1048    
      Qt5Cored.dll !QCoreApplication::sendEvent(QObject * receiver, QEvent * event) Line 234   
      Qt5Cored.dll !QEventDispatcherWin32Private::sendTimerEvent(int timerId) Line 450 
      Qt5Cored.dll !QEventDispatcherWin32::event(QEvent * e) Line 1078 
      Qt5Cored.dll !QCoreApplicationPrivate::notify_helper(QObject * receiver, QEvent * event) Line 1198   
      Qt5Cored.dll !doNotify(QObject * receiver, QEvent * event) Line 1138 
      Qt5Cored.dll !QCoreApplication::notify(QObject * receiver, QEvent * event) Line 1125 
      Qt5Guid.dll !QGuiApplication::notify(QObject * object, QEvent * event) Line 1760 
      Qt5Cored.dll !QCoreApplication::notifyInternal2(QObject * receiver, QEvent * event) Line 1048    
      Qt5Cored.dll !QCoreApplication::sendEvent(QObject * receiver, QEvent * event) Line 234   
      Qt5Cored.dll !QCoreApplicationPrivate::sendPostedEvents(QObject * receiver, int event_type, QThreadData * data) Line 1745    
      Qt5Cored.dll !QEventDispatcherWin32::sendPostedEvents() Line 1085    
      qwindowsd.dll !QWindowsGuiEventDispatcher::sendPostedEvents() Line 82    
      Qt5Cored.dll !qt_internal_proc(HWND__ * hwnd, unsigned int message, unsigned __int64 wp, __int64 lp) Line 239    
      [External Code]
      Qt5Cored.dll !QEventDispatcherWin32::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 630    
      qwindowsd.dll !QWindowsGuiEventDispatcher::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 74   
      Qt5Cored.dll !QEventLoop::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 137   
      Qt5Cored.dll !QEventLoop::exec(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 214    
      Qt5Cored.dll !QCoreApplication::exec() Line 1336 
      Qt5Guid.dll !QGuiApplication::exec() Line 1751   
      Test_Loader_Property.exe !main(int argc, char** argv) Line 15  
      Test_Loader_Property.exe !WinMain(HINSTANCE__ * __formal, HINSTANCE__ * __formal, char* __formal, int __formal) Line 104    
      

       

       

      Attachments

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

        Activity

          People

            erikv Erik Verbruggen
            seven_new Michael
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes