diff options
| author | Olivier Goffart <olivier.goffart@nokia.com> | 2010-04-23 09:43:30 (GMT) |
|---|---|---|
| committer | Olivier Goffart <olivier.goffart@nokia.com> | 2010-05-18 12:46:22 (GMT) |
| commit | e25b5101981dfedd7ceab309b434d0cc15724a27 (patch) | |
| tree | 6094c44cb352783423084701822c4add53e8b0ec | |
| parent | 34a37c95a5130af262854eb7a7ef041908cc7aa8 (diff) | |
| download | Qt-e25b5101981dfedd7ceab309b434d0cc15724a27.zip Qt-e25b5101981dfedd7ceab309b434d0cc15724a27.tar.gz Qt-e25b5101981dfedd7ceab309b434d0cc15724a27.tar.bz2 | |
Only emit the destroyed() signal if connected
Also remove dead code in the exception code
Reviewed-by: Brad
| -rw-r--r-- | src/corelib/kernel/qobject.cpp | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index f1262d6..0544a5a 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -840,22 +840,16 @@ QObject::~QObject() delete d->sharedRefcount; } - 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()."); -#if defined(Q_BUILD_INTERNAL) && !defined(QT_NO_EXCEPTIONS) - struct AutotestException : public std::exception - { - const char *what() const throw() { return "autotest swallow"; } - } autotestException; - // throw autotestException; -#else - QT_RETHROW; -#endif + if (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; + } } if (d->declarativeData) |
