diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/global/qglobal.h | 4 | ||||
-rw-r--r-- | src/corelib/kernel/qobject.cpp | 22 |
2 files changed, 13 insertions, 13 deletions
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 945e45c..2a41b9e 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -1123,14 +1123,14 @@ template <typename T> inline T qAbs(const T &t) { return t >= 0 ? t : -t; } inline int qRound(qreal d) -{ return d >= 0.0 ? int(d + 0.5) : int(d - int(d-1) + 0.5) + int(d-1); } +{ return d >= qreal(0.0) ? int(d + qreal(0.5)) : int(d - int(d-1) + qreal(0.5)) + int(d-1); } #if defined(QT_NO_FPU) || defined(QT_ARCH_ARM) || defined(QT_ARCH_WINDOWSCE) || defined(QT_ARCH_SYMBIAN) inline qint64 qRound64(double d) { return d >= 0.0 ? qint64(d + 0.5) : qint64(d - qreal(qint64(d-1)) + 0.5) + qint64(d-1); } #else inline qint64 qRound64(qreal d) -{ return d >= 0.0 ? qint64(d + 0.5) : qint64(d - qreal(qint64(d-1)) + 0.5) + qint64(d-1); } +{ return d >= qreal(0.0) ? qint64(d + qreal(0.5)) : qint64(d - qreal(qint64(d-1)) + qreal(0.5)) + qint64(d-1); } #endif template <typename T> 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!", |