summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorMartin Smith <msmith@trolltech.com>2010-03-09 11:06:23 (GMT)
committerMartin Smith <msmith@trolltech.com>2010-03-09 11:06:23 (GMT)
commit49bcf035d428d9d8bd2c4d546fc935e9d4ca0a2a (patch)
tree5af36bfada132b514dd20e7860c15d612c306738 /src/corelib
parent8c904712aa658dd0dd405b64913b8e6ade17f3df (diff)
parent382cbd618fe4f5093bb1ca3f4fca3bb35614a18d (diff)
downloadQt-49bcf035d428d9d8bd2c4d546fc935e9d4ca0a2a.zip
Qt-49bcf035d428d9d8bd2c4d546fc935e9d4ca0a2a.tar.gz
Qt-49bcf035d428d9d8bd2c4d546fc935e9d4ca0a2a.tar.bz2
Merge branch '4.7' of git@scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/kernel/qtimer.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/corelib/kernel/qtimer.cpp b/src/corelib/kernel/qtimer.cpp
index e17c995..7650f6a 100644
--- a/src/corelib/kernel/qtimer.cpp
+++ b/src/corelib/kernel/qtimer.cpp
@@ -339,8 +339,20 @@ QT_END_INCLUDE_NAMESPACE
void QTimer::singleShot(int msec, QObject *receiver, const char *member)
{
- if (receiver && member)
+ if (receiver && member) {
+ if (msec == 0) {
+ // special code shortpath for 0-timers
+ const char* bracketPosition = strchr(member, '(');
+ if (!bracketPosition || !(member[0] >= '0' && member[0] <= '3')) {
+ qWarning("QTimer::singleShot: Invalid slot specification");
+ return;
+ }
+ QByteArray methodName(member+1, bracketPosition - 1 - member); // extract method name
+ QMetaObject::invokeMethod(receiver, methodName.constData(), Qt::QueuedConnection);
+ return;
+ }
(void) new QSingleShotTimer(msec, receiver, member);
+ }
}
/*!