diff options
authorMarc Mutz <>2019-06-26 15:32:50 +0200
committerMarc Mutz <>2019-07-03 09:03:24 +0000
commit8d414e67941fdc45ab682b763a119ecc71291483 (patch)
parentfb353592261e04896ad417ce5ace8adda1fe9fdf (diff)
Mark QObject::deleteLater() as \threadsafe
Because it is. It's just QCoreApplication::postEvent(), which is thread-safe. It also _has_ to be, because we recommend to use deleteLater() to delete QObjects that live in another thread: Quoting the ~QObject() docs: > Warning: Deleting a QObject while pending events are waiting to be delivered > can cause a crash. You must not delete the QObject directly if it exists in > a different thread than the one currently executing. Use deleteLater() > instead, which will cause the event loop to delete the object after all > pending events have been delivered to it. If deleteLater() is not thread-safe, it cannot be used for one of its intended purposes. Change-Id: I333d506b42bdfcdff00fe6cefa234c21865625a6 Reviewed-by: MÃ¥rten Nordheim <>
1 files changed, 2 insertions, 0 deletions
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index 68c5460b6a..d685eaf27f 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -2163,6 +2163,8 @@ void QObject::removeEventFilter(QObject *obj)
+ \threadsafe
Schedules this object for deletion.
The object will be deleted when control returns to the event