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

5.3.x regression — crash when changing sourceComponent on asynchronous Loader

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 5.3.2
    • 5.3.0, 5.3.1
    • None
    • b29fac2d05424fd2263ed2ffdd39d2062007a86b

    Description

      The 5.3.x releases of Qt introduced a crash — when using a Loader item with asynchronous property set to true, it may crash, when loaded item has to be destructed before the construction has been finished.

      It can be relatively easily reproduced by quickly setting and disabling sourceComponent property of Loader, given that instantiated component takes enough time to be constructed.

      Please note that the issue affects not only changing the sourceComponent — I believe it may happen every time when components under construction in Loader are interrupted (eg. because of changed sourceComponent or the Loader itself being destructed).

      The following code reproduces the crash. It is non-deterministic but on all 4 platforms I had it run, it crashed in less than 1 second.

      I have checked the same code with Qt 5.2.1 and it was working fine.

      import QtQuick 2.2
      import QtQuick.Window 2.1
      
      Window {
          width : 800
          height : 600
      
          Timer {
              interval: 1
              running: true
              repeat: true
      
              onTriggered: {
                  loader.sourceComponent =  null
                  loader.sourceComponent = component1
              }
      
          }
      
          Loader {
              id : loader
              asynchronous : true
          }
      
          Component {
              id : component1
              Grid {
                  columns: 70
                  spacing: 2
      
                  Repeater {
                      model : 2000
      
                      Rectangle {
                          width : 3
                          height : 3
                          color : "blue"
                      }
                  }
              }
          }
      }
      

      The stacktrace (Qt 5.3.1, MSVC 2013), release build:

       	feeefeee()	Unknown
       	[Frames below may be incorrect and/or missing]	
      >	Qt5Qml.dll!QQmlDelegateModel::~QQmlDelegateModel() Line 239	C++
       	Qt5Quick.dll!QQmlDelegateModel::`scalar deleting destructor'(unsigned int)	C++
       	Qt5Quick.dll!QQuickRepeaterPrivate::~QQuickRepeaterPrivate() Line 63	C++
       	Qt5Quick.dll!QQuickRepeaterPrivate::`scalar deleting destructor'(unsigned int)	C++
       	Qt5Core.dll!QObject::~QObject() Line 1034	C++
       	Qt5Quick.dll!QQmlPrivate::QQmlElement<QQuickRepeater>::`scalar deleting destructor'(unsigned int)	C++
       	Qt5Core.dll!QObjectPrivate::deleteChildren() Line 1932	C++
       	Qt5Core.dll!QObject::~QObject() Line 1032	C++
       	Qt5Quick.dll!QQmlPrivate::QQmlElement<QQuickGrid>::`scalar deleting destructor'(unsigned int)	C++
       	Qt5Core.dll!QObject::event(QEvent * e) Line 1268	C++
       	Qt5Quick.dll!QQuickItem::event(QEvent * ev) Line 7118	C++
       	Qt5Core.dll!QCoreApplicationPrivate::notify_helper(QObject * receiver, QEvent * event) Line 1052	C++
       	Qt5Gui.dll!QGuiApplication::notify(QObject * object, QEvent * event) Line 1471	C++
       	Qt5Core.dll!QCoreApplication::notifyInternal(QObject * receiver, QEvent * event) Line 935	C++
       	Qt5Core.dll!QCoreApplicationPrivate::sendPostedEvents(QObject * receiver, int event_type, QThreadData * data) Line 1539	C++
       	Qt5Core.dll!QCoreApplication::sendPostedEvents(QObject * receiver, int event_type) Line 1397	C++
       	qwindows.dll!QWindowsGuiEventDispatcher::sendPostedEvents() Line 89	C++
       	Qt5Core.dll!qt_internal_proc(HWND__ * hwnd, unsigned int message, unsigned int wp, long lp) Line 423	C++
       	user32.dll!__InternalCallWinProc@20()	Unknown
       	user32.dll!UserCallWinProcCheckWow()	Unknown
       	user32.dll!DispatchMessageWorker()	Unknown
       	user32.dll!_DispatchMessageW@4()	Unknown
       	Qt5Core.dll!QEventDispatcherWin32::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 764	C++
       	qwindows.dll!QWindowsGuiEventDispatcher::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 81	C++
       	Qt5Core.dll!QEventLoop::exec(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 211	C++
       	Qt5Core.dll!QCoreApplication::exec() Line 1188	C++
       	QmlLauncher.exe!main(int argc, char * * argv) Line 197	C++
       	QmlLauncher.exe!__tmainCRTStartup() Line 626	C
       	kernel32.dll!@BaseThreadInitThunk@12()	Unknown
       	ntdll.dll!__RtlUserThreadStart()	Unknown
       	ntdll.dll!__RtlUserThreadStart@8()	Unknown
      

      The stacktrace (Qt 5.3.1, MSVC 2013), debug build:

      >	Qt5Cored.dll!qt_message_fatal(QtMsgType __formal, const QMessageLogContext & context, const QString & message) Line 1357	C++
       	Qt5Cored.dll!QMessageLogger::fatal(const char * msg, ...) Line 669	C++
       	Qt5Cored.dll!qt_assert(const char * assertion, const char * file, int line) Line 2127	C++
       	Qt5Cored.dll!QCoreApplication::arguments() Line 2191	C++
       	Qt5Quickd.dll!contextFactory() Line 89	C++
       	Qt5Quickd.dll!QSGContext::createWindowManager() Line 162	C++
       	Qt5Quickd.dll!QSGRenderLoop::instance() Line 166	C++
       	Qt5Quickd.dll!QQuickWindowPrivate::init(QQuickWindow * c, QQuickRenderControl * control) Line 446	C++
       	Qt5Quickd.dll!QQuickWindow::QQuickWindow(QWindow * parent) Line 1055	C++
       	Qt5Quickd.dll!QQuickWindowQmlImpl::QQuickWindowQmlImpl(QWindow * parent) Line 69	C++
       	Qt5Quickd.dll!QQmlPrivate::QQmlElement<QQuickWindowQmlImpl>::QQmlElement<QQuickWindowQmlImpl>()	C++
       	Qt5Quickd.dll!QQmlPrivate::createInto<QQuickWindowQmlImpl>(void * memory) Line 110	C++
       	Qt5Qmld.dll!QQmlType::create() Line 719	C++
       	Qt5Qmld.dll!QQmlObjectCreator::createInstance(int index, QObject * parent, bool isContextObject) Line 1045	C++
       	Qt5Qmld.dll!QQmlObjectCreator::create(int subComponentIndex, QObject * parent, QQmlInstantiationInterrupt * interrupt) Line 219	C++
       	Qt5Qmld.dll!QQmlComponentPrivate::beginCreate(QQmlContextData * context) Line 884	C++
       	Qt5Qmld.dll!QQmlComponent::beginCreate(QQmlContext * publicContext) Line 834	C++
       	Qt5Qmld.dll!QQmlComponent::create(QQmlContext * context) Line 793	C++
       	Qt5Qmld.dll!QQmlApplicationEnginePrivate::_q_finishLoad(QObject * o) Line 138	C++
       	Qt5Qmld.dll!QQmlApplicationEnginePrivate::startLoad(const QUrl & url, const QByteArray & data, bool dataFlag) Line 118	C++
       	Qt5Qmld.dll!QQmlApplicationEngine::load(const QUrl & url) Line 254	C++
       	Qt5Qmld.dll!QQmlApplicationEngine::QQmlApplicationEngine(const QString & filePath, QObject * parent) Line 231	C++
       	QmlLauncher.exe!main(int argc, char * * argv) Line 186	C++
       	QmlLauncher.exe!__tmainCRTStartup() Line 626	C
       	QmlLauncher.exe!mainCRTStartup() Line 466	C
       	kernel32.dll!@BaseThreadInitThunk@12()	Unknown
       	ntdll.dll!__RtlUserThreadStart()	Unknown
       	ntdll.dll!__RtlUserThreadStart@8()	Unknown
      

      On debug build there is also output: ASSERT: "allArguments.size() == origArgc" in file C:\Qt\qt5\qtbase\src\corelib\kernel\qcoreapplication.cpp, line 2191

      Attachments

        Issue Links

          Activity

            People

              sletta Gunnar Sletta
              mwu Michał Urbańczyk
              Votes:
              3 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: