diff options
author | jieshuzheng <jieshuzheng@gmail.com> | 2009-05-31 10:02:31 (GMT) |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eblomfel@trolltech.com> | 2009-06-02 09:46:31 (GMT) |
commit | 65b2f91df8376df97fed7d7096ac73db838e7d09 (patch) | |
tree | b205370111a5a92d0e7037486ff9e04ac6860e94 /src | |
parent | d7069af3c46c8bcb01be0a3c48e7510738110fba (diff) | |
download | Qt-65b2f91df8376df97fed7d7096ac73db838e7d09.zip Qt-65b2f91df8376df97fed7d7096ac73db838e7d09.tar.gz Qt-65b2f91df8376df97fed7d7096ac73db838e7d09.tar.bz2 |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/kernel/qtimer.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
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(); } |