diff options
author | Olivier Goffart <olivier.goffart@nokia.com> | 2010-08-23 14:49:06 (GMT) |
---|---|---|
committer | Olivier Goffart <olivier.goffart@nokia.com> | 2010-08-23 15:14:04 (GMT) |
commit | b7fd2930986a9be5dd6115bfc4a5c5c517344371 (patch) | |
tree | 48d4c43c0c2ea67fe48ca7370a520837ed3b1ddd /src/corelib | |
parent | dae23694cb89b853785a5772cc7e0477f65ac5bf (diff) | |
download | Qt-b7fd2930986a9be5dd6115bfc4a5c5c517344371.zip Qt-b7fd2930986a9be5dd6115bfc4a5c5c517344371.tar.gz Qt-b7fd2930986a9be5dd6115bfc4a5c5c517344371.tar.bz2 |
QFutureWatcher: display a warning when connecting after calling setFuture()
Reviewed-by: brad
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/concurrent/qfuturewatcher.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/corelib/concurrent/qfuturewatcher.cpp b/src/corelib/concurrent/qfuturewatcher.cpp index d4573c6..21b0789 100644 --- a/src/corelib/concurrent/qfuturewatcher.cpp +++ b/src/corelib/concurrent/qfuturewatcher.cpp @@ -359,6 +359,15 @@ void QFutureWatcherBase::connectNotify(const char * signal) Q_D(QFutureWatcherBase); if (qstrcmp(signal, SIGNAL(resultReadyAt(int))) == 0) d->resultAtConnected.ref(); +#ifndef QT_NO_DEBUG + if (qstrcmp(signal, SIGNAL(finished())) == 0) { + if (futureInterface().isRunning()) { + //connections should be established before calling stFuture to avoid race. + // (The future could finish before the connection is made.) + qWarning("QFutureWatcher::connect: connecting after calling setFuture() is likely to produce race"); + } + } +#endif } void QFutureWatcherBase::disconnectNotify(const char * signal) |