From 4fe865ac7a701b7c950ee0c79b6153b43e1b49ae Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 16 Apr 2015 17:32:18 -0700 Subject: [PATCH] Doc: document future direction of QCoreApplication::notify() It will definitely not be called for events outside the main thread, but we haven't decided for the main thread, in Qt 6. [ChangeLog][Future direction notices] In Qt 6, QCoreApplication::notify() will not be called for events being delivered to objects outside the main thread. The reason for that is that the main application object may begin destruction while those threads are still delivering events, which is undefined behavior. Applications that currently override notify() and use that function outside the main thread are advised to find other solutions in the mean time. Change-Id: I27eaacb532114dd188c4ffff13d5a5c8df3bc85b Reviewed-by: Simon Hausmann --- src/corelib/kernel/qcoreapplication.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index b6f839d554d..ecafe91b433 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -1005,6 +1005,17 @@ bool QCoreApplication::notifyInternal(QObject *receiver, QEvent *event) do not change the focus widget. \endlist + \b{Future direction:} This function will not be called for objects that live + outside the main thread in Qt 6. Applications that need that functionality + should find other solutions for their event inspection needs in the meantime. + The change may be extended to the main thread, causing this function to be + deprecated. + + \warning If you override this function, you must ensure all threads that + process events stop doing so before your application object begins + destruction. This includes threads started by other libraries that you may be + using, but does not apply to Qt's own threads. + \sa QObject::event(), installNativeEventFilter() */