Details
-
Suggestion
-
Resolution: Unresolved
-
Not Evaluated
-
None
-
6.9
-
None
Description
Commit c3a2b9f35a9a12ff3c6f5f0d11844de161b47c2a added categorised logging to the QObject::deleterLater feature. Unfortunately, some of the categorised logging in question happen at very inopportune moments: very late in a thread's exit or in the application's exit. This was first noticed in QTBUG-129927.
I believe this is the worst offender:
d->threadState = QThreadPrivate::Finishing; locker.unlock(); emit thr->finished(QThread::QPrivateSignal()); qCDebug(lcDeleteLater) << "Sending deferred delete events as part of finishing thread" << thr; QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete);
For threads started with QThread, this function is run right after the user's code returns from QThread::run() (except for Qt 6.4-6.8, where it was run later on some platforms, but that was changed back to the historical time with the commit that fixed QTBUG-129927). For adopted threads, this function is runs late, when either PThread runs the pthread_key_t callbacks or the C++ runtime runs the non-trivial destructors.
Specifically, do note the thread that executed main() is an adopted thread.
One crash was noticed in tests/auto/widgets/kernel/qapplication/modal/base.cpp, which calls ::exit() from a QTimer. I believe I fixed that one in QThread itself. The one I can't fix because I can't reproduce is:
$ ctest --test-dir $objdir -R test_add_binary_resources_delayed_file --output-on-failure ... Running test command: "/Users/tjmaciei/obj/qt/qt6/qtbase/tests/auto/cmake/test_add_binary_resources_delayed_file/test_add_binary_resources_delayed_file" Test command failed: /Users/tjmaciei/obj/qt/qt6/qtbase/tests/auto/cmake/test_add_binary_resources_delayed_file/test_add_binary_resources_delayed_file [4223500.427] (9701 36767941)(unknown): ASSERT failure in Type &QtGlobalStatic::Impl<QtGlobalStatic::Holder<(anonymous namespace)::Q_QGS_defaultLocalePrivate, (anonymous namespace)::Q_QGS_defaultLocalePrivate>>::operator*() const [Holder = QtGlobalStatic::Holder<(anonymous namespace)::Q_QGS_defaultLocalePrivate, (anonymous namespace)::Q_QGS_defaultLocalePrivate>]: "The global static was used after being destroyed", file /Users/tjmaciei/src/qt/qt6/qtbase/src/corelib/global/qglobalstatic.h, line 136
Attachments
Gerrit Reviews
For Gerrit Dashboard: QTBUG-132429 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
613505,4 | Revert "Add categorized logging of delete later machinery" | dev | qt/qtbase | Status: NEW | 0 | 0 |
613664,2 | tst_Q*Application: add tests for unusual qApp creations and exits | dev | qt/qtbase | Status: NEW | 0 | -1 |