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

Replacing signal handlers in a PropertyChanges can lead to double deallocation

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 4.8.1, 4.8.4, 5.0.1
    • None
    • Ubuntu 12.10

    Description

      In some cases it seems Qt gets confused about the parenting of the signal handler expression. I have attached a simple test case (main.qml) that causes a crash when you close it.

      To reproduce: Click the window twice or more (to change state at least twice), then close the window.

      In the attached example (one of) the expression gets deallocated first here:
      0 QObject::~QObject qobject.cpp 818 0x7ffff62fb8af
      1 QDeclarativeExpression::~QDeclarativeExpression qdeclarativeexpression.cpp 336 0x7ffff793f81a
      2 QDeclarativeExpression::~QDeclarativeExpression qdeclarativeexpression.cpp 338 0x7ffff793f84c
      3 QDeclarativeReplaceSignalHandler::~QDeclarativeReplaceSignalHandler qdeclarativepropertychanges.cpp 145 0x7ffff7837525
      4 QDeclarativeReplaceSignalHandler::~QDeclarativeReplaceSignalHandler qdeclarativepropertychanges.cpp 146 0x7ffff78375ce
      5 QDeclarativePropertyChanges::~QDeclarativePropertyChanges qdeclarativepropertychanges.cpp 382 0x7ffff7834dc2
      6 QDeclarativePrivate::QDeclarativeElement<QDeclarativePropertyChanges>::~QDeclarativeElement qdeclarativeprivate.h 87 0x7ffff7800075
      7 QDeclarativePrivate::QDeclarativeElement<QDeclarativePropertyChanges>::~QDeclarativeElement qdeclarativeprivate.h 87 0x7ffff78000ca
      8 QObjectPrivate::deleteChildren qobject.cpp 1907 0x7ffff62fd61a
      9 QObject::~QObject qobject.cpp 926 0x7ffff62fbd4b
      10 QDeclarativeState::~QDeclarativeState qdeclarativestate.cpp 171 0x7ffff7820afe
      11 QDeclarativePrivate::QDeclarativeElement<QDeclarativeState>::~QDeclarativeElement qdeclarativeprivate.h 87 0x7ffff780039f
      12 QDeclarativePrivate::QDeclarativeElement<QDeclarativeState>::~QDeclarativeElement qdeclarativeprivate.h 87 0x7ffff78003f4
      13 QObjectPrivate::deleteChildren qobject.cpp 1907 0x7ffff62fd61a
      14 QObject::~QObject qobject.cpp 926 0x7ffff62fbd4b
      15 QGraphicsObject::~QGraphicsObject qgraphicsitem.h 547 0x7ffff78c48cb
      16 QDeclarativeItem::~QDeclarativeItem qdeclarativeitem.cpp 1660 0x7ffff78be068
      17 QDeclarativeRectangle::~QDeclarativeRectangle qdeclarativerectangle_p.h 136 0x7ffff788b1f0
      18 QDeclarativePrivate::QDeclarativeElement<QDeclarativeRectangle>::~QDeclarativeElement qdeclarativeprivate.h 87 0x7ffff7890d11
      19 QDeclarativePrivate::QDeclarativeElement<QDeclarativeRectangle>::~QDeclarativeElement qdeclarativeprivate.h 87 0x7ffff7890d72
      20 QGraphicsScene::clear qgraphicsscene.cpp 2442 0x7ffff7108aa0
      ... <More>

      And then later here (as m_expression):
      0 ??
      1 QDeclarativeBoundSignal::~QDeclarativeBoundSignal qdeclarativeboundsignal.cpp 133 0x7ffff7985db9
      2 QDeclarativeBoundSignal::~QDeclarativeBoundSignal qdeclarativeboundsignal.cpp 135 0x7ffff7985e4a
      3 QObjectPrivate::deleteChildren qobject.cpp 1907 0x7ffff62fd61a
      4 QObject::~QObject qobject.cpp 926 0x7ffff62fbd4b
      5 QGraphicsObject::~QGraphicsObject qgraphicsitem.h 547 0x7ffff78c48cb
      6 QDeclarativeItem::~QDeclarativeItem qdeclarativeitem.cpp 1660 0x7ffff78be068
      7 QDeclarativeRectangle::~QDeclarativeRectangle qdeclarativerectangle_p.h 136 0x7ffff788b1f0
      8 QDeclarativePrivate::QDeclarativeElement<QDeclarativeRectangle>::~QDeclarativeElement qdeclarativeprivate.h 87 0x7ffff7890d11
      9 QDeclarativePrivate::QDeclarativeElement<QDeclarativeRectangle>::~QDeclarativeElement qdeclarativeprivate.h 87 0x7ffff7890d72
      10 QGraphicsScene::clear qgraphicsscene.cpp 2442 0x7ffff7108aa0
      11 QGraphicsScene::~QGraphicsScene qgraphicsscene.cpp 1649 0x7ffff7106b21
      12 QDeclarativeScene::~QDeclarativeScene qdeclarativeview.cpp 77 0x7ffff7805bc6
      13 QDeclarativeScene::~QDeclarativeScene qdeclarativeview.cpp 77 0x7ffff7805bf8
      14 QObjectPrivate::deleteChildren qobject.cpp 1907 0x7ffff62fd61a
      15 QWidget::~QWidget qwidget.cpp 1681 0x7ffff693b0c1
      16 QFrame::~QFrame qframe.cpp 240 0x7ffff6e90438
      17 QAbstractScrollArea::~QAbstractScrollArea qabstractscrollarea.cpp 521 0x7ffff6f3adc2
      18 QGraphicsView::~QGraphicsView qgraphicsview.cpp 1158 0x7ffff7136db2
      19 QDeclarativeView::~QDeclarativeView qdeclarativeview.cpp 310 0x7ffff7801f2d
      20 QmlApplicationViewer::~QmlApplicationViewer qmlapplicationviewer.cpp 98 0x4034cb
      ... <More>

      Attachments

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

        Activity

          People

            aalpert Alan Alpert
            tronil Troels Nilsson
            Votes:
            13 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes