diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 557329e..fbbcf2b 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -1658,6 +1658,17 @@ QWidget::~QWidget() if (d->hasGuards) QObjectPrivate::clearGuards(this); + 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) { QAbstractDeclarativeData::destroyed(d->declarativeData, this); d->declarativeData = 0; // don't activate again in ~QObject