Invalidate incore cache when refreshing

If an incore cache of an aggregated RideFileCache is invalidated
by a ride in the same period being edited it does not clear
until the cache array is cleared (25 of them so likely to be
never) or upon a restart.

This fixes them being invalidated by refreshCache.
This commit is contained in:
Mark Liversedge
2013-03-29 18:15:34 +00:00
parent 66daab662f
commit 81ecdf8d04

View File

@@ -297,6 +297,18 @@ RideFileCache::refreshCache()
// all done now, phew
cacheFile.close();
// invalidate any incore cache of aggregate
// that contains this ride in its date range
QDate date = ride->startTime().date();
for (int i=0; i<main->cpxCache.count();) {
if (date >= main->cpxCache.at(i)->start &&
date <= main->cpxCache.at(i)->end) {
delete main->cpxCache.at(i);
main->cpxCache.removeAt(i);
} else i++;
}
} else if (writeerror == false) {
// popup the first time...