diff options
Diffstat (limited to 'src/corelib/kernel/qbasictimer.cpp')
-rw-r--r-- | src/corelib/kernel/qbasictimer.cpp | 27 |
1 files changed, 2 insertions, 25 deletions
diff --git a/src/corelib/kernel/qbasictimer.cpp b/src/corelib/kernel/qbasictimer.cpp index 637c98cd40..13d90c1620 100644 --- a/src/corelib/kernel/qbasictimer.cpp +++ b/src/corelib/kernel/qbasictimer.cpp @@ -115,24 +115,7 @@ QT_BEGIN_NAMESPACE */ void QBasicTimer::start(int msec, QObject *obj) { - QAbstractEventDispatcher *eventDispatcher = QAbstractEventDispatcher::instance(); - if (Q_UNLIKELY(!eventDispatcher)) { - qWarning("QBasicTimer::start: QBasicTimer can only be used with threads started with QThread"); - return; - } - if (Q_UNLIKELY(obj && obj->thread() != eventDispatcher->thread())) { - qWarning("QBasicTimer::start: Timers cannot be started from another thread"); - return; - } - if (id) { - if (Q_LIKELY(eventDispatcher->unregisterTimer(id))) - QAbstractEventDispatcherPrivate::releaseTimerId(id); - else - qWarning("QBasicTimer::start: Stopping previous timer failed. Possibly trying to stop from a different thread"); - } - id = 0; - if (obj) - id = eventDispatcher->registerTimer(msec, Qt::CoarseTimer, obj); + start(msec, Qt::CoarseTimer, obj); } /*! @@ -161,13 +144,7 @@ void QBasicTimer::start(int msec, Qt::TimerType timerType, QObject *obj) qWarning("QBasicTimer::start: Timers cannot be started from another thread"); return; } - if (id) { - if (Q_LIKELY(eventDispatcher->unregisterTimer(id))) - QAbstractEventDispatcherPrivate::releaseTimerId(id); - else - qWarning("QBasicTimer::start: Stopping previous timer failed. Possibly trying to stop from a different thread"); - } - id = 0; + stop(); if (obj) id = eventDispatcher->registerTimer(msec, timerType, obj); } |