summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qbasictimer.cpp
diff options
context:
space:
mode:
authorBradley T. Hughes <bradley.hughes@nokia.com>2012-01-04 12:22:33 +0100
committerQt by Nokia <qt-info@nokia.com>2012-01-05 08:42:23 +0100
commitd8d4cc39629fbd498981f5b78a8412f1cbba2372 (patch)
treedb4791db58f97f7894cf2bbef40d14dbb01d464c /src/corelib/kernel/qbasictimer.cpp
parent1fdfc2abfe1fa26b86028934d4853432e25b4655 (diff)
Warn when using QBasicTimer::start() incorrectly
Previously, QObject::startTimer() would warn when called from QBasicTimer::start() if there was no event dispatcher for the object's thread. QBasicTimer::start() should output a similar warning when there is no event dispatcher for the current thread. Change-Id: I1152f73216c3551c252a7a6995defebc9e1506c8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
Diffstat (limited to 'src/corelib/kernel/qbasictimer.cpp')
-rw-r--r--src/corelib/kernel/qbasictimer.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/corelib/kernel/qbasictimer.cpp b/src/corelib/kernel/qbasictimer.cpp
index 5890df392f..617e5e560f 100644
--- a/src/corelib/kernel/qbasictimer.cpp
+++ b/src/corelib/kernel/qbasictimer.cpp
@@ -116,8 +116,10 @@ QT_BEGIN_NAMESPACE
void QBasicTimer::start(int msec, QObject *obj)
{
QAbstractEventDispatcher *eventDispatcher = QAbstractEventDispatcher::instance();
- if (!eventDispatcher)
+ if (!eventDispatcher) {
+ qWarning("QBasicTimer::start: QBasicTimer can only be used with threads started with QThread");
return;
+ }
if (id) {
eventDispatcher->unregisterTimer(id);
QAbstractEventDispatcherPrivate::releaseTimerId(id);
@@ -141,8 +143,10 @@ void QBasicTimer::start(int msec, QObject *obj)
void QBasicTimer::start(int msec, Qt::TimerType timerType, QObject *obj)
{
QAbstractEventDispatcher *eventDispatcher = QAbstractEventDispatcher::instance();
- if (!eventDispatcher)
+ if (!eventDispatcher) {
+ qWarning("QBasicTimer::start: QBasicTimer can only be used with threads started with QThread");
return;
+ }
if (id) {
eventDispatcher->unregisterTimer(id);
QAbstractEventDispatcherPrivate::releaseTimerId(id);