QEventLoop: better describe the exception safety of Qt
1) In general it's unsafe to let exceptions propagate through Qt code, so document that. 2) Add a note that overriding notify() makes sense only in Qt 5, in Qt 6 it's going away. 3) The advice applies also to applications not using QApplication, but just QCoreApplication. Change-Id: I4f6e74c53da757faf2eeaa9de226ceba55c52536 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Martin Smith <martin.smith@theqtcompany.com>
This commit is contained in:
parent
3b5db8f3a6
commit
daade9b90d
@ -182,8 +182,10 @@ int QEventLoop::exec(ProcessEventsFlags flags)
|
||||
{
|
||||
if (exceptionCaught) {
|
||||
qWarning("Qt has caught an exception thrown from an event handler. Throwing\n"
|
||||
"exceptions from an event handler is not supported in Qt. You must\n"
|
||||
"reimplement QApplication::notify() and catch all exceptions there.\n");
|
||||
"exceptions from an event handler is not supported in Qt.\n"
|
||||
"You must not let any exception whatsoever propagate through Qt code.\n"
|
||||
"If that is not possible, in Qt 5 you must at least reimplement\n"
|
||||
"QCoreApplication::notify() and catch all exceptions there.\n");
|
||||
}
|
||||
locker.relock();
|
||||
QEventLoop *eventLoop = d->threadData->eventLoops.pop();
|
||||
|
Loading…
x
Reference in New Issue
Block a user