From 2fa7b3b317fa941064ec4ba62163e3244becf55a Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Tue, 26 May 2015 22:16:25 +0200 Subject: [PATCH] Q(Unhandled)Exception: declare dtor out-of-line De-duplicates vtables and enables RTTI on this hierarchy. This is esp. important for exception classes, as RTTI is used to select the catch clause to handle the exception in-flight. The issue is made a bit complicated by the fact that the exception specification changed from C++98 to 11 and that C++98 clients require the empty throw() specification while we don't want to introduce warnings for C++11 users. Let's hope no compiler includes throw specs into the mangled names. Task-number: QTBUG-45582 Change-Id: If086c8c38fccdc2c9c7e2aa7a492192cc1f86a6c Reviewed-by: Thiago Macieira --- src/corelib/thread/qexception.cpp | 10 ++++++++++ src/corelib/thread/qexception.h | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/corelib/thread/qexception.cpp b/src/corelib/thread/qexception.cpp index acc3663936..550bdc8fe4 100644 --- a/src/corelib/thread/qexception.cpp +++ b/src/corelib/thread/qexception.cpp @@ -107,6 +107,11 @@ QT_BEGIN_NAMESPACE \internal */ +QException::~QException() +{ + // must stay empty until ### Qt 6 +} + void QException::raise() const { QException e = *this; @@ -118,6 +123,11 @@ QException *QException::clone() const return new QException(*this); } +QUnhandledException::~QUnhandledException() +{ + // must stay empty until ### Qt 6 +} + void QUnhandledException::raise() const { QUnhandledException e = *this; diff --git a/src/corelib/thread/qexception.h b/src/corelib/thread/qexception.h index 55fc441020..edf361ebd3 100644 --- a/src/corelib/thread/qexception.h +++ b/src/corelib/thread/qexception.h @@ -53,6 +53,11 @@ QT_BEGIN_NAMESPACE class Q_CORE_EXPORT QException : public std::exception { public: + ~QException() +#ifndef Q_COMPILER_NOEXCEPT + throw() +#endif + ; virtual void raise() const; virtual QException *clone() const; }; @@ -60,6 +65,11 @@ public: class Q_CORE_EXPORT QUnhandledException : public QException { public: + ~QUnhandledException() +#ifndef Q_COMPILER_NOEXCEPT + throw() +#endif +; void raise() const Q_DECL_OVERRIDE; QUnhandledException *clone() const Q_DECL_OVERRIDE; };