From 357351b7ab8ab2eee865d2449ffcca9c9f502fd3 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sat, 21 Dec 2024 11:01:43 -0300 Subject: Revert "Add categorized logging of delete later machinery" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit c3a2b9f35a9a12ff3c6f5f0d11844de161b47c2a. Unfortunately, some of the log messages happen WAY too late at process exit time, when QtCore is unloading. In particular, the worst offender is the one in QThreadPrivate::finish(), which is called after the last QObject in the thread that called ::exit() was getting destroyed. This implies we have Static (De)Initialization Order Fiascos happening (the logging recurses into qlocale.cpp and the defaultLocalePrivate global static has already been destroyed). I need to revert this commit in order to fix QThreadData destruction. The functionality is welcome back in QtCore once the fixes are in, so long as whoever does it fixes the issues we're seeing in the CI (and I can't reproduce on my development machine). I've created QTBUG-132429 to track the reversal and see if the functionality can be brought back in. Task-number: QTBUG-120124 Task-number: QTBUG-132429 Pick-to: 6.9 6.8 Change-Id: Iecf8f14529c7a2bb2185fffdfd328066098826b1 Reviewed-by: Tor Arne Vestbø --- src/corelib/kernel/qobject.cpp | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'src/corelib/kernel/qobject.cpp') diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 7c179c4bde5..2a419aabf8e 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -1413,7 +1413,6 @@ bool QObject::event(QEvent *e) break; case QEvent::DeferredDelete: - qCDebug(lcDeleteLater) << "Deferred deleting" << this; delete this; break; @@ -2464,10 +2463,8 @@ void QObject::deleteLater() // as long as we're not guarding every access to the bit field. Q_D(QObject); - if (d->deleteLaterCalled) { - qCDebug(lcDeleteLater) << "Skipping deleteLater for already deferred object" << this; + if (d->deleteLaterCalled) return; - } d->deleteLaterCalled = true; @@ -2493,16 +2490,10 @@ void QObject::deleteLater() // non-conformant code path, and our best guess is that the scope level // should be 1. (Loop level 0 is special: it means that no event loops // are running.) - if (scopeLevel == 0 && loopLevel != 0) { - qCDebug(lcDeleteLater) << "Delete later called with scope level 0" - << "but loop level is > 0. Assuming scope is 1"; + if (scopeLevel == 0 && loopLevel != 0) scopeLevel = 1; - } } - qCDebug(lcDeleteLater) << "Posting deferred delete for" << this - << "with loop level" << loopLevel << "and scope level" << scopeLevel; - eventListLocker.unlock(); QCoreApplication::postEvent(this, new QDeferredDeleteEvent(loopLevel, scopeLevel)); -- cgit v1.2.3