From 65b2f91df8376df97fed7d7096ac73db838e7d09 Mon Sep 17 00:00:00 2001 From: jieshuzheng Date: Sun, 31 May 2009 18:02:31 +0800 Subject: Remove the redundant timer kill and start when the two QTimer::start(int) is made in succession If you restart the QTimer like the following code snippet shows, the timer will get killed and started twice. QTimer timer; timer.start(100); timer.start(1000); Since QTimer::start(int msec) calls QTimer::setInterval(int msec), and QTimer::setInterval(int msec) will kill the timer and start another one if there is already a timer running. And QTimer::start() will do the same thing again. It is a performance penalty here. Under Windows, it will result in one extra call of SetTimer(). And under Symbian, it will result in one extra new and delete of CPeriodic and adding and removing it from AS. --- src/corelib/kernel/qtimer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/kernel/qtimer.cpp b/src/corelib/kernel/qtimer.cpp index 08821d4..8ca53b9 100644 --- a/src/corelib/kernel/qtimer.cpp +++ b/src/corelib/kernel/qtimer.cpp @@ -211,7 +211,7 @@ void QTimer::start() */ void QTimer::start(int msec) { - setInterval(msec); + inter = msec; start(); } -- cgit v0.12