summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichal Klocek <michal.klocek@qt.io>2021-10-27 09:03:53 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-11-01 18:59:07 +0000
commit0309c3c5bd8480a622a61ad7bce3e294aaec5c0f (patch)
treeda890e0ffa83d4751040e3a90ecf9ac6cecec8f0 /src
parent9d04f06c75ff8b30a31c2da9a25d966ae9f104a3 (diff)
Add warning about QCoreApplication deferred delete
In some bug reports we got code which does deleteLater() on QCoreApplication, however this is not going to work as the user may expect. In cases where an application uses Qt WebEngine, this leads to weird looking crashes on exit as webenginecontext is not destroyed. Change-Id: I4d284f30b0c7cad15ba6da3d65cdf813c36ee036 Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> (cherry picked from commit eb5cae26a43beae747909777da3f29fad82fef5e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/kernel/qobject.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index 427fb55ecd..2f9b8391e1 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -2299,6 +2299,10 @@ void QObject::removeEventFilter(QObject *obj)
*/
void QObject::deleteLater()
{
+#ifdef QT_DEBUG
+ if (qApp == this)
+ qWarning("You are deferring the delete of QCoreApplication, this may not work as expected.");
+#endif
QCoreApplication::postEvent(this, new QDeferredDeleteEvent());
}