summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-09-15 11:52:02 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-09-15 11:52:02 (GMT)
commitb832dffc1eb85181aa2d99afd1a6c764b634091d (patch)
tree4e0d73f6ba0b5398c6c9b4d817fdb82b54b6ecad /src
parent2344254329a6231dab9daf04fa99823c3c68be49 (diff)
parent7d861db82b9f8204c2fdc3c12220dd03bdb7b255 (diff)
downloadQt-b832dffc1eb85181aa2d99afd1a6c764b634091d.zip
Qt-b832dffc1eb85181aa2d99afd1a6c764b634091d.tar.gz
Qt-b832dffc1eb85181aa2d99afd1a6c764b634091d.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2: The test livelock of QTimer is now expected to work Make sure mapSelectionFromSource does not return a selection with invalid ranges. QEventDispatcherUnix: do not process too many timer if other events need to be processed first
Diffstat (limited to 'src')
-rw-r--r--src/corelib/kernel/qeventdispatcher_unix.cpp22
-rw-r--r--src/gui/itemviews/qabstractproxymodel.cpp16
2 files changed, 25 insertions, 13 deletions
diff --git a/src/corelib/kernel/qeventdispatcher_unix.cpp b/src/corelib/kernel/qeventdispatcher_unix.cpp
index 9dadd82..f50994c 100644
--- a/src/corelib/kernel/qeventdispatcher_unix.cpp
+++ b/src/corelib/kernel/qeventdispatcher_unix.cpp
@@ -549,18 +549,22 @@ int QTimerInfoList::activateTimers()
if (qt_disable_lowpriority_timers || isEmpty())
return 0; // nothing to do
- bool firstTime = true;
- timeval currentTime;
- int n_act = 0, maxCount = count();
+ int n_act = 0, maxCount = 0;
firstTimerInfo = 0;
- while (maxCount--) {
- currentTime = updateCurrentTime();
- if (firstTime) {
- repairTimersIfNeeded();
- firstTime = false;
- }
+ timeval currentTime = updateCurrentTime();
+ repairTimersIfNeeded();
+
+ // Find out how many timer have expired
+ for (QTimerInfoList::const_iterator it = constBegin(); it != constEnd(); ++it) {
+ if (currentTime < (*it)->timeout)
+ break;
+ maxCount++;
+ }
+
+ //fire the timers.
+ while (maxCount--) {
if (isEmpty())
break;
diff --git a/src/gui/itemviews/qabstractproxymodel.cpp b/src/gui/itemviews/qabstractproxymodel.cpp
index 43a1327..1c600e2 100644
--- a/src/gui/itemviews/qabstractproxymodel.cpp
+++ b/src/gui/itemviews/qabstractproxymodel.cpp
@@ -187,8 +187,12 @@ QItemSelection QAbstractProxyModel::mapSelectionToSource(const QItemSelection &p
{
QModelIndexList proxyIndexes = proxySelection.indexes();
QItemSelection sourceSelection;
- for (int i = 0; i < proxyIndexes.size(); ++i)
- sourceSelection << QItemSelectionRange(mapToSource(proxyIndexes.at(i)));
+ for (int i = 0; i < proxyIndexes.size(); ++i) {
+ const QModelIndex proxyIdx = mapToSource(proxyIndexes.at(i));
+ if (!proxyIdx.isValid())
+ continue;
+ sourceSelection << QItemSelectionRange(proxyIdx);
+ }
return sourceSelection;
}
@@ -201,8 +205,12 @@ QItemSelection QAbstractProxyModel::mapSelectionFromSource(const QItemSelection
{
QModelIndexList sourceIndexes = sourceSelection.indexes();
QItemSelection proxySelection;
- for (int i = 0; i < sourceIndexes.size(); ++i)
- proxySelection << QItemSelectionRange(mapFromSource(sourceIndexes.at(i)));
+ for (int i = 0; i < sourceIndexes.size(); ++i) {
+ const QModelIndex srcIdx = mapFromSource(sourceIndexes.at(i));
+ if (!srcIdx.isValid())
+ continue;
+ proxySelection << QItemSelectionRange(srcIdx);
+ }
return proxySelection;
}