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

Calling QThread::terminate() in destructor causes double object destruction

    XMLWordPrintable

Details

    • Windows
    • 865212057b (qt/qtbase/dev) 865212057b (qt/tqtc-qtbase/dev) d85238e0cc (qt/qtbase/6.3) d85238e0cc (qt/tqtc-qtbase/6.3) 2be951ab8c (qt/qtbase/6.4) 2be951ab8c (qt/tqtc-qtbase/6.4)

    Description

      This problem has been separated from QTBUG-93298.
      Attached simple reproducer that demonstrates the issue with calling QThread::terminate() on destruction of some object in Qt Quick items hierarchy.

      Steps to reproduce:
      1. Build and run (in Debug mode) attached project
      2. Close the window and observe assertion

      There is recursive call of object's destructor in stack trace:

      1  qt_message_fatal                                                                 qlogging.cpp              1876 0x7ffbdbe4ca24 
      2  QMessageLogger::fatal                                                            qlogging.cpp              891  0x7ffbdbe4aec8 
      3  qt_assert_x                                                                      qglobal.cpp               3299 0x7ffbdbe38b9e 
      4  ThreadWrapper::~ThreadWrapper                                                    threadwrapper.cpp         26   0x7ff6a11e3df8 
      5  ThreadWrapper::`scalar deleting destructor'                                      untitled3                      0x7ff6a11e4047 
      6  qDeleteInEventHandler                                                            qobject.cpp               4778 0x7ffbdc07b0bb 
      7  QObject::event                                                                   qobject.cpp               1357 0x7ffbdc070904 
      8  QCoreApplicationPrivate::notify_helper                                           qcoreapplication.cpp      1228 0x7ffbdbfab5c2 
      9  doNotify                                                                         qcoreapplication.cpp      1157 0x7ffbdbfadcb0 
      10 QCoreApplication::notify                                                         qcoreapplication.cpp      1144 0x7ffbdbfa7fe2 
      11 QGuiApplication::notify                                                          qguiapplication.cpp       1944 0x7ffbcd3ac0df 
      12 QCoreApplication::notifyInternal2                                                qcoreapplication.cpp      1067 0x7ffbdbfa9eb7 
      13 QCoreApplication::sendEvent                                                      qcoreapplication.cpp      1476 0x7ffbdbfa76df 
      14 QCoreApplicationPrivate::sendPostedEvents                                        qcoreapplication.cpp      1834 0x7ffbdbfac21f 
      15 QCoreApplication::sendPostedEvents                                               qcoreapplication.cpp      1694 0x7ffbdbfa7acd 
      16 QThreadPrivate::finish                                                           qthread_win.cpp           344  0x7ffbdc3c2e38 
      17 QThread::terminate                                                               qthread_win.cpp           519  0x7ffbdc3c25c9 
      18 ThreadWrapper::~ThreadWrapper                                                    threadwrapper.cpp         28   0x7ff6a11e3e1b 
      19 QQmlPrivate::QQmlElement<ThreadWrapper>::~QQmlElement<ThreadWrapper>             qqmlprivate.h             133  0x7ff6a11e4b9d 
      20 QQmlPrivate::QQmlElement<ThreadWrapper>::`scalar deleting destructor'            untitled3                      0x7ff6a11e5277 
      21 QObjectPrivate::deleteChildren                                                   qobject.cpp               2110 0x7ffbdc078873 
      22 QObject::~QObject                                                                qobject.cpp               1120 0x7ffbdc07077d 
      23 QQuickItem::~QQuickItem                                                          qquickitem.cpp            2392 0x7ffbe16e8b46 
      24 QQuickImplicitSizeItem::~QQuickImplicitSizeItem                                  Qt6Quickd                      0x7ffbe1628bb4 
      25 QQuickLoader::~QQuickLoader                                                      qquickloader.cpp          317  0x7ffbe1780a2c 
      26 QQmlPrivate::QQmlElement<QQuickLoader>::~QQmlElement<QQuickLoader>               qqmlprivate.h             133  0x7ffbe1c6540e 
      27 QQmlPrivate::QQmlElement<QQuickLoader>::`scalar deleting destructor'             Qt6Quickd                      0x7ffbe1c8af38 
      28 QObjectPrivate::deleteChildren                                                   qobject.cpp               2110 0x7ffbdc078873 
      29 QObject::~QObject                                                                qobject.cpp               1120 0x7ffbdc07077d 
      30 QWindow::~QWindow                                                                qwindow.cpp               235  0x7ffbcd47383b 
      31 QQuickWindow::~QQuickWindow                                                      qquickwindow.cpp          1159 0x7ffbe18f33b3 
      32 QQuickWindowQmlImpl::~QQuickWindowQmlImpl                                        Qt6Quickd                      0x7ffbe1920f66 
      33 QQmlPrivate::QQmlElement<QQuickWindowQmlImpl>::~QQmlElement<QQuickWindowQmlImpl> qqmlprivate.h             133  0x7ffbe1c6714e 
      34 QQmlPrivate::QQmlElement<QQuickWindowQmlImpl>::`scalar deleting destructor'      Qt6Quickd                      0x7ffbe1c8d2a8 
      35 qDeleteAll<QList<QObject *>::const_iterator>                                     qalgorithms.h             59   0x7ffbdda694fe 
      36 qDeleteAll<QList<QObject *>>                                                     qalgorithms.h             68   0x7ffbdda69487 
      37 QQmlApplicationEnginePrivate::cleanUp                                            qqmlapplicationengine.cpp 67   0x7ffbdda667ad 
      38 QQmlApplicationEngine::~QQmlApplicationEngine                                    qqmlapplicationengine.cpp 277  0x7ffbdda65c2c 
      39 main                                                                             main.cpp                  19   0x7ff6a11e2ff5 
      40 WinMain                                                                          qtentrypoint_win.cpp      97   0x7ff6a11e8b12 
      41 invoke_main                                                                      exe_common.inl            107  0x7ff6a11e6b52 
      42 __scrt_common_main_seh                                                           exe_common.inl            288  0x7ff6a11e6a3e 
      43 __scrt_common_main                                                               exe_common.inl            331  0x7ff6a11e68fe 
      44 WinMainCRTStartup                                                                exe_winmain.cpp           17   0x7ff6a11e6bee 
      45 BaseThreadInitThunk                                                              KERNEL32                       0x7ffc6cf97034 
      46 RtlUserThreadStart                                                               ntdll                          0x7ffc6d602651 
      

      Attachments

        Issue Links

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

          Activity

            People

              studiosus Vladimir Belyavsky
              studiosus Vladimir Belyavsky
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: