summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@woboq.com>2013-01-19 16:17:51 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-02-04 14:22:45 +0100
commit91e12dca757a8ef5c4691b70eb80db61a9d47e83 (patch)
tree856a08868f205490c68919c9a5bc66c9353468a9 /src/corelib/kernel
parent86ca28774be1f91af26b518f0e945f00ffe6ba4a (diff)
QThread documentation: do not discourage the reimplementation of QThread
The new QThread documentation now really discourage to reimplement QThread. But in fact, there are many cases where it is perfectly fine. And the example given is even a case where using worker object is wrong. The examle even contains a leak since the thread will never stop and will even leak. This changes put back some sentences from before commit d4ad9dbbf96884c0899e8f8116a8a056facd52d5. The sample code has been re-writen. Notice how reimpementing run takes less lines of code, less runtime overhead, no leaks, and also is more complete than the previous example. Change-Id: I6cb80826e917dd5ce442ccad2572ec692ccb25ab Reviewed-by: Andre Somers <andre@familiesomers.nl> Reviewed-by: Geir Vattekar <geir.vattekar@digia.com> Reviewed-by: Debao Zhang <hello@debao.me> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/kernel')
-rw-r--r--src/corelib/kernel/qobject.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index d125946781..a82242939d 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -1917,7 +1917,11 @@ void QObject::removeEventFilter(QObject *obj)
loop. If the event loop is not running when this function is
called (e.g. deleteLater() is called on an object before
QCoreApplication::exec()), the object will be deleted once the
- event loop is started.
+ event loop is started. If deleteLater() is called after the main event loop
+ has stopped, the object will not be deleted.
+ Since Qt 4.8, if deleteLater() is called on an object that lives in a
+ thread with no running event loop, the object will be destroyed when the
+ thread finishes.
Note that entering and leaving a new event loop (e.g., by opening a modal
dialog) will \e not perform the deferred deletion; for the object to be