mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-13 08:08:42 +00:00
Fix 3b50dd8 for reentrancy
Changed static variable for a member one, the problem was apparent when opening a different athlete besides the initial one.
This commit is contained in:
@@ -82,6 +82,9 @@ struct RideDBContext {
|
||||
// is cache/rideDB.json an older version ?
|
||||
bool old;
|
||||
int loading;
|
||||
|
||||
// tracks the last progress update sent
|
||||
double lastProgressUpdate;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -82,11 +82,10 @@ ride: '{' rideelement_list '}' {
|
||||
jc->api->writeRideLine(jc->item, jc->request, jc->response);
|
||||
#endif
|
||||
} else {
|
||||
static double last = 0.0;
|
||||
double progress= round(double(jc->loading++) / double(jc->cache->rides().count()) * 100.0f);
|
||||
if (progress > last) {
|
||||
if (progress > jc->lastProgressUpdate) {
|
||||
jc->context->notifyLoadProgress(jc->folder,progress);
|
||||
last = progress;
|
||||
jc->lastProgressUpdate = progress;
|
||||
}
|
||||
|
||||
// find entry and update it
|
||||
@@ -344,6 +343,7 @@ RideCache::load()
|
||||
jc->api = NULL;
|
||||
jc->old = false;
|
||||
jc->loading = 0;
|
||||
jc->lastProgressUpdate = 0.0;
|
||||
jc->folder = context->athlete->home->root().canonicalPath();
|
||||
|
||||
// clean item
|
||||
|
||||
Reference in New Issue
Block a user