From 477721250dfc9d83a74bced6765dff19a1ceebf3 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 6 Jul 2015 21:16:09 -0700 Subject: [PATCH] Remove the warning printed when QObject's destructor catches exceptions The warning is useless, since the application is about to terminate anyway. The user will be better informed by getting a proper backtrace of the throw point, instead of the rethrow point inside QObject's destructor. The application WILL terminate because C++11 destructors are noexcept and GCC 6 enforces it: qobject.cpp:909:13: error: throw will always call terminate() [- Werror=terminate] qobject.cpp:909:13: note: in C++11 destructors default to noexcept QT_RETHROW; ^ Change-Id: Ib056b47dde3341ef9a52ffff13ee8f01d874d224 Reviewed-by: Marc Mutz Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/kernel/qobject.cpp | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 676a529dfe2..cc6970eaeb0 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -900,14 +900,7 @@ QObject::~QObject() } if (!d->isWidget && d->isSignalConnected(0)) { - QT_TRY { - emit destroyed(this); - } QT_CATCH(...) { - // all the signal/slots connections are still in place - if we don't - // quit now, we will crash pretty soon. - qWarning("Detected an unexpected exception in ~QObject while emitting destroyed()."); - QT_RETHROW; - } + emit destroyed(this); } if (d->declarativeData) {