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

Crash when deleting item currently set in PropertyChanges target

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P1: Critical
    • Resolution: Done
    • Affects Version/s: 5.3.2, 5.9.1
    • Fix Version/s: 5.9.6
    • Labels:
      None

      Description

      When restoring replaced signal handlers, qquickproperty changes tries to use a deleted object it seems. Here's a minimal qml example that crashes in qmlscene:

      import QtQuick 2.1
      
      Item {
          id: root
          Component {
              id: c1
              Item {
                  signal signalFromC1
              }
          }
      
          Component {
              id: c2
              Item {
                  signal signalFromC2
              }
          }
      
          Loader {
              id: loader
          }
      
          Timer {
              property int step: 0
              running: true
              repeat: true
              interval: 1
              onTriggered: {
                  switch (step) {
                  case 0:
                      loader.sourceComponent = c1
                      root.state = "s1"
                      break;
                  case 1:
                      loader.sourceComponent = c2
                      root.state = "s2"
                      break;
                  case 2:
                      loader.sourceComponent = c1
                      root.state = "s1"
                      break;
                  }
                  step += 1;
              }
          }
      
          states: [
              State {
                  name: "s1"
                  PropertyChanges {
                      target: loader.item
                      onSignalFromC1: {
                          console.log("signalFromC1");
                      }
                  }
              },
              State {
                  name: "s2"
                  PropertyChanges {
                      target: loader.item
                      onSignalFromC2: {
                          console.log("signalFromC2");
                      }
                  }
              }
          ]
      }
      

      And here's the gdb backtrace:

      #0  0x00007ffff6f33ca2 in QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData> >::data (this=0x8) at /home/hhvaal/build/qt5.3/qtbase/include/QtCore/../../src/corelib/tools/qscopedpointer.h:143
      #1  0x00007ffff6f41452 in qGetPtrHelper<QScopedPointer<QObjectData> > (p=...) at /home/hhvaal/build/qt5.3/qtbase/include/QtCore/../../src/corelib/global/qglobal.h:945
      #2  0x00007ffff6f41a9c in QObject::d_func (this=0x0) at /home/hhvaal/build/qt5.3/qtbase/include/QtCore/../../src/corelib/kernel/qobject.h:118
      #3  0x00007ffff6f41bd2 in QObjectPrivate::get (o=0x0) at /home/hhvaal/build/qt5.3/qtbase/include/QtCore/5.3.2/QtCore/private/../../../../../src/corelib/kernel/qobject_p.h:199
      #4  0x00007ffff6f426ed in QQmlData::get (object=0x0, create=false) at /home/hhvaal/build/qt5.3/qtbase/include/QtQml/5.3.2/QtQml/private/../../../../../../qtdeclarative/src/qml/qml/qqmldata_p.h:196
      #5  0x00007ffff717af41 in QQmlPropertyPrivate::signalExpression (that=...) at qml/qqmlproperty.cpp:954
      #6  0x00007ffff77be662 in QQuickReplaceSignalHandler::saveCurrentValues (this=0xc1b950) at util/qquickpropertychanges.cpp:184
      #7  0x00007ffff77be559 in QQuickReplaceSignalHandler::saveOriginals (this=0xc1b950) at util/qquickpropertychanges.cpp:166
      #8  0x00007ffff77b35a4 in QQuickState::apply (this=0xa079d0, trans=0x0, revert=0xa07c50) at util/qquickstate.cpp:612
      #9  0x00007ffff77c3d00 in QQuickStateGroupPrivate::setCurrentStateInternal (this=0xa07900, state="s1", ignoreTrans=false) at util/qquickstategroup.cpp:487
      #10 0x00007ffff77c2b73 in QQuickStateGroup::setState (this=0xa078d0, state="s1") at util/qquickstategroup.cpp:293
      #11 0x00007ffff7888ca0 in QQuickItemPrivate::setState (this=0xa06d60, state="s1") at items/qquickitem.cpp:4337
      #12 0x00007ffff7888d0f in QQuickItem::setState (this=0xad76e0, state="s1") at items/qquickitem.cpp:4371
      #13 0x00007ffff789309d in QQuickItem::qt_metacall (this=0xad76e0, _c=QMetaObject::WriteProperty, _id=15, _a=0x7fffffffc3a0) at .moc/moc_qquickitem.cpp:882
      #14 0x00007ffff57283f7 in QMetaObject::metacall (object=0xad76e0, cl=QMetaObject::WriteProperty, idx=16, argv=0x7fffffffc3a0) at kernel/qmetaobject.cpp:308
      #15 0x00007ffff71270b2 in QV4::QObjectWrapper::setProperty (object=0xad76e0, ctx=0x7fffffffc5b0, property=0x7fffdc0362c8, value=...) at jsruntime/qv4qobjectwrapper.cpp:536
      #16 0x00007ffff71279a5 in QV4::QObjectWrapper::setProperty (this=0x7fffe803ea30, ctx=0x7fffffffc5b0, propertyIndex=16, value=...) at jsruntime/qv4qobjectwrapper.cpp:647
      #17 0x00007ffff7141506 in QV4::Runtime::setQmlQObjectProperty (ctx=0x7fffffffc5b0, object=..., propertyIndex=16, value=...) at jsruntime/qv4runtime.cpp:1332
      #18 0x00007ffff7fb85aa in ?? ()
      #19 0x00007fffffffc500 in ?? ()
      #20 0x00007ffff709afa1 in QV4::ExecutionContext::ExecutionContext (this=0x0, engine=0x7fffe40016f0, t=0) at jsruntime/qv4context_p.h:93
      #21 0x00007ffff70cd1d8 in QV4::SimpleScriptFunction::call (that=0x7fffe803eb20, callData=0x7fffe3800008) at jsruntime/qv4functionobject.cpp:529
      #22 0x00007ffff7014784 in QV4::Object::call (this=0x7fffe803eb20, d=0x7fffe3800008) at /home/hhvaal/build/qt5.3/qtbase/include/QtQml/5.3.2/QtQml/private/../../../../../../qtdeclarative/src/qml/jsruntime/qv4object_p.h:270
      #23 0x00007ffff7200317 in QQmlJavaScriptExpression::evaluate (this=0xae00c0, context=0xad7310, function=..., callData=0x7fffe3800008, isUndefined=0x0) at qml/qqmljavascriptexpression.cpp:166
      #24 0x00007ffff718f13f in QQmlBoundSignalExpression::evaluate (this=0xae00a0, a=0x0) at qml/qqmlboundsignal.cpp:289
      #25 0x00007ffff718f7f0 in QQmlBoundSignal_callback (e=0xadfdb8, a=0x0) at qml/qqmlboundsignal.cpp:416
      #26 0x00007ffff71df74a in QQmlNotifier::emitNotify (endpoint=0xadfdb8, a=0x0) at qml/qqmlnotifier.cpp:81
      #27 0x00007ffff716065b in QQmlData::signalEmitted (object=0xadf780, index=3, a=0x0) at qml/qqmlengine.cpp:720
      #28 0x00007ffff576439c in QMetaObject::activate (sender=0xadf780, signalOffset=3, local_signal_index=0, argv=0x0) at kernel/qobject.cpp:3568
      #29 0x00007ffff576418a in QMetaObject::activate (sender=0xadf780, m=0x7ffff7692f20 <QQmlTimer::staticMetaObject>, local_signal_index=0, argv=0x0) at kernel/qobject.cpp:3547
      #30 0x00007ffff72a8465 in QQmlTimer::triggered (this=0xadf780) at .moc/moc_qqmltimer_p.cpp:249
      #31 0x00007ffff7294408 in QQmlTimer::ticked (this=0xadf780) at types/qqmltimer.cpp:315
      #32 0x00007ffff7294714 in QQmlTimerPrivate::animationCurrentLoopChanged (this=0xadf7b0) at types/qqmltimer.cpp:63
      #33 0x00007ffff7261497 in QAbstractAnimationJob::currentLoopChanged (this=0xadf830) at animations/qabstractanimationjob.cpp:624
      #34 0x00007ffff7260e3d in QAbstractAnimationJob::setCurrentTime (this=0xadf830, msecs=402) at animations/qabstractanimationjob.cpp:506
      #35 0x00007ffff725f867 in QQmlAnimationTimer::updateAnimationsTime (this=0x659fa0, delta=1) at animations/qabstractanimationjob.cpp:119
      #36 0x00007ffff54636ef in QUnifiedTimer::updateAnimationTimers (this=0x6c92f0, currentTick=-1) at animation/qabstractanimation.cpp:292
      #37 0x00007ffff5463da9 in QUnifiedTimer::timerEvent (this=0x6c92f0, event=0x7fffffffd330) at animation/qabstractanimation.cpp:405
      #38 0x00007ffff575dc07 in QObject::event (this=0x6c92f0, e=0x7fffffffd330) at kernel/qobject.cpp:1222
      #39 0x00007ffff65d0c46 in QApplicationPrivate::notify_helper (this=0x65b550, receiver=0x6c92f0, e=0x7fffffffd330) at kernel/qapplication.cpp:3499
      #40 0x00007ffff65ce331 in QApplication::notify (this=0x7fffffffd7a0, receiver=0x6c92f0, e=0x7fffffffd330) at kernel/qapplication.cpp:2952
      #41 0x00007ffff571f20b in QCoreApplication::notifyInternal (this=0x7fffffffd7a0, receiver=0x6c92f0, event=0x7fffffffd330) at kernel/qcoreapplication.cpp:935
      #42 0x00007ffff57230d7 in QCoreApplication::sendEvent (receiver=0x6c92f0, event=0x7fffffffd330) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:237
      #43 0x00007ffff579c40b in QTimerInfoList::activateTimers (this=0x6b15a0) at kernel/qtimerinfo_unix.cpp:643
      #44 0x00007ffff579d8ec in timerSourceDispatch (source=0x6b1540) at kernel/qeventdispatcher_glib.cpp:185
      #45 0x00007ffff3bcec3d in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
      #46 0x00007ffff3bcef20 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
      #47 0x00007ffff3bcefcc in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
      #48 0x00007ffff579e304 in QEventDispatcherGlib::processEvents (this=0x6aa2e0, flags=...) at kernel/qeventdispatcher_glib.cpp:426
      #49 0x00007fffecb4f7c2 in QPAEventDispatcherGlib::processEvents (this=0x6aa2e0, flags=...) at eventdispatchers/qeventdispatcher_glib.cpp:123
      #50 0x00007ffff571bc0a in QEventLoop::processEvents (this=0x7fffffffd620, flags=...) at kernel/qeventloop.cpp:136
      #51 0x00007ffff571bf22 in QEventLoop::exec (this=0x7fffffffd620, flags=...) at kernel/qeventloop.cpp:212
      #52 0x00007ffff571f975 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1188
      

        Attachments

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

          Activity

            People

            Assignee:
            qt.team.quick.subscriptions Qt Quick and Widgets Team
            Reporter:
            hhvaal Harald Hvaal
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes