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

Crash in StackView by triggering consecutive calls to clear method

    XMLWordPrintable

    Details

      Description

      The attached minimal example leads to crash with the following backtrace:

      #0  0x000000000072f9b0 in ?? ()
      #1  0x00007fffec0fd3e6 in qDeleteAll<QQuickStackElement* const*> (end=<optimized out>, begin=0x695648)
          at /home/user/work/source/ntgdeps/build/qt/build/qtbase/include/QtCore/../../../../../Downloads/qt/qtbase/src/corelib/tools/qalgorithms.h:320
      #2  qDeleteAll<QStack<QQuickStackElement*> > (c=...) at /home/user/work/source/ntgdeps/build/qt/build/qtbase/include/QtCore/../../../../../Downloads/qt/qtbase/src/corelib/tools/qalgorithms.h:328
      #3  QQuickStackView::clear (this=<optimized out>, operation=QQuickStackView::Immediate) at /home/user/work/source/ntgdeps/build/Downloads/qt/qtquickcontrols2/src/quicktemplates2/qquickstackview.cpp:913
      #4  0x00007fffec122e4b in QQuickStackView::qt_static_metacall (_o=_o@entry=0x682bf0, _c=_c@entry=QMetaObject::InvokeMetaMethod, _id=_id@entry=10, _a=_a@entry=0x7fffffff8750) at .moc/moc_qquickstackview_p.cpp:271
      #5  0x00007fffec1232d8 in QQuickStackView::qt_metacall (this=0x682bf0, _c=QMetaObject::InvokeMetaMethod, _id=10, _a=0x7fffffff8750) at .moc/moc_qquickstackview_p.cpp:454
      #6  0x00007ffff6a75ed9 in QQmlObjectOrGadget::metacall (this=this@entry=0x7fffffff8ac0, type=type@entry=QMetaObject::InvokeMetaMethod, index=index@entry=88, argv=<optimized out>)
          at /home/user/work/source/ntgdeps/build/Downloads/qt/qtdeclarative/src/qml/qml/qqmlpropertycache.cpp:1770
      #7  0x00007ffff6979001 in CallMethod (object=..., index=<optimized out>, returnType=<optimized out>, argCount=<optimized out>, argTypes=<optimized out>, engine=engine@entry=0x63b640, callArgs=0x7fffdefaa688, 
          callType=QMetaObject::InvokeMetaMethod) at /home/user/work/source/ntgdeps/build/Downloads/qt/qtdeclarative/src/qml/jsruntime/qv4qobjectwrapper.cpp:1295
      #8  0x00007ffff697a78d in CallPrecise (object=..., data=..., engine=engine@entry=0x63b640, callArgs=callArgs@entry=0x7fffdefaa688, callType=callType@entry=QMetaObject::InvokeMetaMethod)
          at /home/user/work/source/ntgdeps/build/Downloads/qt/qtdeclarative/src/qml/jsruntime/qv4qobjectwrapper.cpp:1557
      #9  0x00007ffff697b93c in CallOverloaded (callType=QMetaObject::InvokeMetaMethod, propertyCache=0x7fffd809acd0, callArgs=<optimized out>, engine=0x63b640, data=..., object=...)
          at /home/user/work/source/ntgdeps/build/Downloads/qt/qtdeclarative/src/qml/jsruntime/qv4qobjectwrapper.cpp:1631
      #10 QV4::QObjectMethod::callInternal (this=<optimized out>, thisObject=<optimized out>, argv=<optimized out>, argc=<optimized out>)
          at /home/user/work/source/ntgdeps/build/Downloads/qt/qtdeclarative/src/qml/jsruntime/qv4qobjectwrapper.cpp:2120
      #11 0x00007ffff699849b in QV4::FunctionObject::call (argc=<optimized out>, argv=<optimized out>, thisObject=<optimized out>, this=<optimized out>)
          at ../../include/QtQml/5.12.5/QtQml/private/../../../../../../../../Downloads/qt/qtdeclarative/src/qml/jsruntime/qv4functionobject_p.h:202
      #12 QV4::Moth::VME::interpret (frame=0x7fffffff8e20, engine=0x63b640, code=0x7ffff144a1c4 "\016\002") at /home/user/work/source/ntgdeps/build/Downloads/qt/qtdeclarative/src/qml/jsruntime/qv4vme_moth.cpp:738
      #13 0x00007ffff699b3f9 in QV4::Moth::VME::exec (frame=frame@entry=0x7fffffff8e20, engine=engine@entry=0x63b640)
          at /home/user/work/source/ntgdeps/build/Downloads/qt/qtdeclarative/src/qml/jsruntime/qv4vme_moth.cpp:447
      #14 0x00007ffff692e326 in QV4::Function::call (this=this@entry=0x682790, thisObject=<optimized out>, argv=<optimized out>, argc=<optimized out>, context=<optimized out>)
          at /home/user/work/source/ntgdeps/build/Downloads/qt/qtdeclarative/src/qml/jsruntime/qv4function.cpp:68
      #15 0x00007ffff6aa04cc in QQmlJavaScriptExpression::evaluate (this=this@entry=0x699b50, callData=callData@entry=0x7fffdefaa5d0, isUndefined=isUndefined@entry=0x0)
          at /home/user/work/source/ntgdeps/build/Downloads/qt/qtdeclarative/src/qml/qml/qqmljavascriptexpression.cpp:211
      #16 0x00007ffff6a435c2 in QQmlBoundSignalExpression::evaluate (this=this@entry=0x699b50, a=a@entry=0x0) at /home/user/work/source/ntgdeps/build/Downloads/qt/qtdeclarative/src/qml/qml/qqmlboundsignal.cpp:225
      #17 0x00007ffff6a44b6b in QQmlBoundSignal_callback (e=0x699ad0, a=0x0) at /home/user/work/source/ntgdeps/build/Downloads/qt/qtdeclarative/src/qml/qml/qqmlboundsignal.cpp:358
      #18 0x00007ffff6a80517 in QQmlNotifier::emitNotify (endpoint=<optimized out>, a=a@entry=0x0) at /home/user/work/source/ntgdeps/build/Downloads/qt/qtdeclarative/src/qml/qml/qqmlnotifier.cpp:104
      #19 0x00007ffff6a25374 in QQmlData::signalEmitted (object=0x699890, index=4, a=0x0) at /home/user/work/source/ntgdeps/build/Downloads/qt/qtdeclarative/src/qml/qml/qqmlengine.cpp:883
      #20 0x00007ffff64bb772 in QMetaObject::activate (sender=0x699890, signalOffset=<optimized out>, local_signal_index=local_signal_index@entry=1, argv=argv@entry=0x0)
          at /home/user/work/source/ntgdeps/build/Downloads/qt/qtbase/src/corelib/kernel/qobject.cpp:3675
      #21 0x00007ffff64bba17 in QMetaObject::activate (sender=<optimized out>, m=m@entry=0x7ffff6c63260 <QQmlComponentAttached::staticMetaObject>, local_signal_index=local_signal_index@entry=1, argv=argv@entry=0x0)
          at /home/user/work/source/ntgdeps/build/Downloads/qt/qtbase/src/corelib/kernel/qobject.cpp:3656
      #22 0x00007ffff6b69b33 in QQmlComponentAttached::destruction (this=<optimized out>) at .moc/moc_qqmlcomponentattached_p.cpp:148
      #23 0x00007ffff6a3fec1 in QQmlContextData::emitDestruction (this=0x698dd0) at /home/user/work/source/ntgdeps/build/Downloads/qt/qtdeclarative/src/qml/qml/qqmlcontext.cpp:562
      #24 0x00007ffff6a3fee8 in QQmlContextData::emitDestruction (this=0x697210) at /home/user/work/source/ntgdeps/build/Downloads/qt/qtdeclarative/src/qml/qml/qqmlcontext.cpp:567
      #25 0x00007ffff6a3fee8 in QQmlContextData::emitDestruction (this=0x696a30) at /home/user/work/source/ntgdeps/build/Downloads/qt/qtdeclarative/src/qml/qml/qqmlcontext.cpp:567
      #26 0x00007ffff6a405b9 in QQmlContextData::invalidate (this=this@entry=0x696a30) at /home/user/work/source/ntgdeps/build/Downloads/qt/qtdeclarative/src/qml/qml/qqmlcontext.cpp:576
      #27 0x00007ffff6a403f2 in QQmlContextData::destroy (this=0x696a30) at /home/user/work/source/ntgdeps/build/Downloads/qt/qtdeclarative/src/qml/qml/qqmlcontext.cpp:633
      #28 0x00007ffff6a40585 in QQmlContext::~QQmlContext (this=0x695b00, __in_chrg=<optimized out>) at /home/user/work/source/ntgdeps/build/Downloads/qt/qtdeclarative/src/qml/qml/qqmlcontext.cpp:221
      #29 0x00007ffff6a40599 in QQmlContext::~QQmlContext (this=0x695b00, __in_chrg=<optimized out>) at /home/user/work/source/ntgdeps/build/Downloads/qt/qtdeclarative/src/qml/qml/qqmlcontext.cpp:222
      #30 0x00007fffec0fa860 in QQuickStackElement::~QQuickStackElement (this=0x696830, __in_chrg=<optimized out>)
          at /home/user/work/source/ntgdeps/build/Downloads/qt/qtquickcontrols2/src/quicktemplates2/qquickstackelement.cpp:111
      #31 0x00007fffec0fa959 in QQuickStackElement::~QQuickStackElement (this=0x696830, __in_chrg=<optimized out>)
          at /home/user/work/source/ntgdeps/build/Downloads/qt/qtquickcontrols2/src/quicktemplates2/qquickstackelement.cpp:112
      #32 0x00007fffec0fd3e6 in qDeleteAll<QQuickStackElement* const*> (end=<optimized out>, begin=0x695650)
          at /home/user/work/source/ntgdeps/build/qt/build/qtbase/include/QtCore/../../../../../Downloads/qt/qtbase/src/corelib/tools/qalgorithms.h:320
      #33 qDeleteAll<QStack<QQuickStackElement*> > (c=...) at /home/user/work/source/ntgdeps/build/qt/build/qtbase/include/QtCore/../../../../../Downloads/qt/qtbase/src/corelib/tools/qalgorithms.h:328
      #34 QQuickStackView::clear (this=<optimized out>, operation=QQuickStackView::Immediate) at /home/user/work/source/ntgdeps/build/Downloads/qt/qtquickcontrols2/src/quicktemplates2/qquickstackview.cpp:913
      #35 0x00007fffec122e4b in QQuickStackView::qt_static_metacall (_o=_o@entry=0x682bf0, _c=_c@entry=QMetaObject::InvokeMetaMethod, _id=_id@entry=10, _a=_a@entry=0x7fffffffaf40) at .moc/moc_qquickstackview_p.cpp:271
      #36 0x00007fffec1232d8 in QQuickStackView::qt_metacall (this=0x682bf0, _c=QMetaObject::InvokeMetaMethod, _id=10, _a=0x7fffffffaf40) at .moc/moc_qquickstackview_p.cpp:454
      #37 0x00007ffff6a75ed9 in QQmlObjectOrGadget::metacall (this=this@entry=0x7fffffffb2b0, type=type@entry=QMetaObject::InvokeMetaMethod, index=index@entry=88, argv=<optimized out>)
          at /home/user/work/source/ntgdeps/build/Downloads/qt/qtdeclarative/src/qml/qml/qqmlpropertycache.cpp:1770
      #38 0x00007ffff6979001 in CallMethod (object=..., index=<optimized out>, returnType=<optimized out>, argCount=<optimized out>, argTypes=<optimized out>, engine=engine@entry=0x63b640, callArgs=0x7fffdefaa588, 
          callType=QMetaObject::InvokeMetaMethod) at /home/user/work/source/ntgdeps/build/Downloads/qt/qtdeclarative/src/qml/jsruntime/qv4qobjectwrapper.cpp:1295
      #39 0x00007ffff697a78d in CallPrecise (object=..., data=..., engine=engine@entry=0x63b640, callArgs=callArgs@entry=0x7fffdefaa588, callType=callType@entry=QMetaObject::InvokeMetaMethod)
          at /home/user/work/source/ntgdeps/build/Downloads/qt/qtdeclarative/src/qml/jsruntime/qv4qobjectwrapper.cpp:1557
      #40 0x00007ffff697b93c in CallOverloaded (callType=QMetaObject::InvokeMetaMethod, propertyCache=0x7fffd809acd0, callArgs=<optimized out>, engine=0x63b640, data=..., object=...)
          at /home/user/work/source/ntgdeps/build/Downloads/qt/qtdeclarative/src/qml/jsruntime/qv4qobjectwrapper.cpp:1631
      #41 QV4::QObjectMethod::callInternal (this=<optimized out>, thisObject=<optimized out>, argv=<optimized out>, argc=<optimized out>)
      ---Type <return> to continue, or q <return> to quit---
          at /home/user/work/source/ntgdeps/build/Downloads/qt/qtdeclarative/src/qml/jsruntime/qv4qobjectwrapper.cpp:2120
      #42 0x00007ffff699849b in QV4::FunctionObject::call (argc=<optimized out>, argv=<optimized out>, thisObject=<optimized out>, this=<optimized out>)
          at ../../include/QtQml/5.12.5/QtQml/private/../../../../../../../../Downloads/qt/qtdeclarative/src/qml/jsruntime/qv4functionobject_p.h:202
      #43 QV4::Moth::VME::interpret (frame=0x7fffffffb610, engine=0x63b640, code=0x7ffff144a2a7 "\016\002") at /home/user/work/source/ntgdeps/build/Downloads/qt/qtdeclarative/src/qml/jsruntime/qv4vme_moth.cpp:738
      #44 0x00007ffff699b3f9 in QV4::Moth::VME::exec (frame=frame@entry=0x7fffffffb610, engine=engine@entry=0x63b640)
          at /home/user/work/source/ntgdeps/build/Downloads/qt/qtdeclarative/src/qml/jsruntime/qv4vme_moth.cpp:447
      #45 0x00007ffff692e326 in QV4::Function::call (this=this@entry=0x657f10, thisObject=<optimized out>, argv=<optimized out>, argc=<optimized out>, context=<optimized out>)
          at /home/user/work/source/ntgdeps/build/Downloads/qt/qtdeclarative/src/qml/jsruntime/qv4function.cpp:68
      #46 0x00007ffff6aa04cc in QQmlJavaScriptExpression::evaluate (this=this@entry=0x686990, callData=callData@entry=0x7fffdefaa4d0, isUndefined=isUndefined@entry=0x0)
          at /home/user/work/source/ntgdeps/build/Downloads/qt/qtdeclarative/src/qml/qml/qqmljavascriptexpression.cpp:211
      #47 0x00007ffff6a435c2 in QQmlBoundSignalExpression::evaluate (this=this@entry=0x686990, a=a@entry=0x0) at /home/user/work/source/ntgdeps/build/Downloads/qt/qtdeclarative/src/qml/qml/qqmlboundsignal.cpp:225
      #48 0x00007ffff6a44b6b in QQmlBoundSignal_callback (e=0x686920, a=0x0) at /home/user/work/source/ntgdeps/build/Downloads/qt/qtdeclarative/src/qml/qml/qqmlboundsignal.cpp:358
      #49 0x00007ffff6a80517 in QQmlNotifier::emitNotify (endpoint=<optimized out>, a=a@entry=0x0) at /home/user/work/source/ntgdeps/build/Downloads/qt/qtdeclarative/src/qml/qml/qqmlnotifier.cpp:104
      #50 0x00007ffff6a25374 in QQmlData::signalEmitted (object=0x6866e0, index=3, a=0x0) at /home/user/work/source/ntgdeps/build/Downloads/qt/qtdeclarative/src/qml/qml/qqmlengine.cpp:883
      #51 0x00007ffff64bb772 in QMetaObject::activate (sender=0x6866e0, signalOffset=<optimized out>, local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x0)
          at /home/user/work/source/ntgdeps/build/Downloads/qt/qtbase/src/corelib/kernel/qobject.cpp:3675
      #52 0x00007ffff64bba17 in QMetaObject::activate (sender=<optimized out>, m=m@entry=0x7ffff6c62ea0 <QQmlTimer::staticMetaObject>, local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x0)
          at /home/user/work/source/ntgdeps/build/Downloads/qt/qtbase/src/corelib/kernel/qobject.cpp:3656
      #53 0x00007ffff6b26ff0 in QQmlTimer::triggered (this=<optimized out>) at .moc/moc_qqmltimer_p.cpp:265
      #54 0x00007ffff6b2741f in QQmlTimer::ticked (this=<optimized out>) at /home/user/work/source/ntgdeps/build/Downloads/qt/qtdeclarative/src/qml/types/qqmltimer.cpp:323
      #55 0x00007ffff6b276ec in QQmlTimer::event (this=0x6866e0, e=<optimized out>) at /home/user/work/source/ntgdeps/build/Downloads/qt/qtdeclarative/src/qml/types/qqmltimer.cpp:335
      #56 0x00007ffff73e4d3c in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0x6866e0, e=0x6e6990)
          at /home/user/work/source/ntgdeps/build/Downloads/qt/qtbase/src/widgets/kernel/qapplication.cpp:3700
      #57 0x00007ffff73ec420 in QApplication::notify (this=0x4262a0, receiver=0x6866e0, e=0x6e6990) at /home/user/work/source/ntgdeps/build/Downloads/qt/qtbase/src/widgets/kernel/qapplication.cpp:3446
      #58 0x00007ffff648d7c8 in QCoreApplication::notifyInternal2 (receiver=0x6866e0, event=0x6e6990) at /home/user/work/source/ntgdeps/build/Downloads/qt/qtbase/src/corelib/kernel/qcoreapplication.cpp:1088
      #59 0x00007ffff648d99e in QCoreApplication::sendEvent (receiver=<optimized out>, event=event@entry=0x6e6990)
          at /home/user/work/source/ntgdeps/build/Downloads/qt/qtbase/src/corelib/kernel/qcoreapplication.cpp:1476
      #60 0x00007ffff649045a in QCoreApplicationPrivate::sendPostedEvents (receiver=receiver@entry=0x0, event_type=event_type@entry=0, data=0x426440)
          at /home/user/work/source/ntgdeps/build/Downloads/qt/qtbase/src/corelib/kernel/qcoreapplication.cpp:1825
      #61 0x00007ffff64908c8 in QCoreApplication::sendPostedEvents (receiver=receiver@entry=0x0, event_type=event_type@entry=0)
          at /home/user/work/source/ntgdeps/build/Downloads/qt/qtbase/src/corelib/kernel/qcoreapplication.cpp:1679
      #62 0x00007ffff64e8513 in postEventSourceDispatch (s=0x4fe910) at /home/user/work/source/ntgdeps/build/Downloads/qt/qtbase/src/corelib/kernel/qeventdispatcher_glib.cpp:276
      #63 0x00007ffff4071197 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
      #64 0x00007ffff40713f0 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
      #65 0x00007ffff407149c in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
      #66 0x00007ffff64e7aff in QEventDispatcherGlib::processEvents (this=0x4fae40, flags=...) at /home/user/work/source/ntgdeps/build/Downloads/qt/qtbase/src/corelib/kernel/qeventdispatcher_glib.cpp:422
      #67 0x00007ffff648ba8a in QEventLoop::exec (this=this@entry=0x7fffffffd8d0, flags=..., flags@entry=...) at /home/user/work/source/ntgdeps/build/Downloads/qt/qtbase/src/corelib/kernel/qeventloop.cpp:225
      #68 0x00007ffff6494c14 in QCoreApplication::exec () at /home/user/work/source/ntgdeps/build/Downloads/qt/qtbase/src/corelib/kernel/qcoreapplication.cpp:1389
      #69 0x00007ffff6da6c5c in QGuiApplication::exec () at /home/user/work/source/ntgdeps/build/Downloads/qt/qtbase/src/gui/kernel/qguiapplication.cpp:1784
      #70 0x0000000000406128 in main (argc=2, argv=<optimized out>) at /home/user/work/source/ntgdeps/build/Downloads/qt/qtdeclarative/tools/qmlscene/main.cpp:686
      
      import QtQuick 2.9
      import QtQuick.Controls 2.5
      
      Item {
          StackView {
              id: _stackView
              anchors.fill: parent
              initialItem: Item {}
      
              Component.onCompleted: _stackView.push(btn, StackView.Immediate)
          }
      
          Component {
              id: btn
      
              Button {
                  width: 100
                  height: 100
                  text: "Test"
                  
                  Component.onDestruction: {
                      console.log("TestButton destruction");
                      _stackView.clear(StackView.Immediate);
                  }
              }
          }
      
          Timer {
              interval: 1000 
              running: true 
              repeat: true
              onTriggered: _stackView.clear(StackView.Immediate)
          }
      }
      

        Attachments

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

          Activity

            People

            Assignee:
            mitch_curtis Mitch Curtis
            Reporter:
            dmytrokh Dmytro Khlopov
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes