summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorOlivier Goffart <olivier.goffart@nokia.com>2011-01-14 11:16:35 (GMT)
committerOlivier Goffart <olivier.goffart@nokia.com>2011-01-17 15:07:17 (GMT)
commit4c466703eb096b7ea0e18fb1efee0729ac688772 (patch)
tree9c2213e9e994257b0af9e36f96c4fc7631690b22 /src/corelib
parent77c4df1325c4bae10c99978a325febada9fd82d0 (diff)
downloadQt-4c466703eb096b7ea0e18fb1efee0729ac688772.zip
Qt-4c466703eb096b7ea0e18fb1efee0729ac688772.tar.gz
Qt-4c466703eb096b7ea0e18fb1efee0729ac688772.tar.bz2
Fix the warnings when QBasicTimer are member of the ObjectPrivate
If a class has QBasicTimer as member of a derived class QObjectPrivate, the QBasicTimer will be destroyed after the timer has been cleaned. The QBasicTimer will stop the timer in its destructor. But that means that the same timer will be stoped twice, leading to ugly bugs. Reviewed-by: Thiago Reviewed-by: Brad Task-number: QTBUG-16558 Task-number: QTBUG-16175
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/kernel/qobject.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index 2e9d003..c6153cb 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -161,6 +161,17 @@ QObjectPrivate::QObjectPrivate(int version)
QObjectPrivate::~QObjectPrivate()
{
+ if (pendTimer) {
+ // unregister pending timers
+ if (threadData->eventDispatcher)
+ threadData->eventDispatcher->unregisterTimers(q_ptr);
+ }
+
+ if (postedEvents)
+ QCoreApplication::removePostedEvents(q_ptr, 0);
+
+ threadData->deref();
+
delete static_cast<QAbstractDynamicMetaObject*>(metaObject);
#ifdef QT_JAMBI_BUILD
if (deleteWatch)
@@ -911,25 +922,14 @@ QObject::~QObject()
}
}
- if (d->pendTimer) {
- // unregister pending timers
- if (d->threadData->eventDispatcher)
- d->threadData->eventDispatcher->unregisterTimers(this);
- }
-
if (!d->children.isEmpty())
d->deleteChildren();
qt_removeObject(this);
- if (d->postedEvents)
- QCoreApplication::removePostedEvents(this, 0);
-
if (d->parent) // remove it from parent object
d->setParent_helper(0);
- d->threadData->deref();
-
#ifdef QT_JAMBI_BUILD
if (d->inEventHandler) {
qWarning("QObject: Do not delete object, '%s', during its event handler!",