From b49602e7a9e9ecf811d793be612aceba570a6f51 Mon Sep 17 00:00:00 2001 From: Jens Arnold Date: Wed, 28 Feb 2007 23:43:38 +0000 Subject: [PATCH] Fix a potential race condition with cuesheets (that hit every time in an archos test), plus a slight optimisation. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12524 a1c6a512-1295-4272-9138-f99709370657 --- apps/gui/gwps-common.c | 44 ++++++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c index 8fa80c725a..f5e3bc2489 100644 --- a/apps/gui/gwps-common.c +++ b/apps/gui/gwps-common.c @@ -2610,30 +2610,28 @@ bool update(struct gui_wps *gwps) sizeof(gwps->state->current_track_path)); } - if (cuesheet_is_enabled() && gwps->state->id3->cuesheet_type - && (gwps->state->id3->elapsed < curr_cue->curr_track->offset - || (curr_cue->curr_track_idx < curr_cue->track_count - 1 - && gwps->state->id3->elapsed >= (curr_cue->curr_track+1)->offset))) - { - /* We've changed tracks within the cuesheet : - we need to update the ID3 info and refresh the WPS */ - - cue_find_current_track(curr_cue, gwps->state->id3->elapsed); - cue_spoof_id3(curr_cue, gwps->state->id3); - - gwps->display->stop_scroll(); - if (gui_wps_display()) - retcode = true; - else{ - gui_wps_refresh(gwps, 0, WPS_REFRESH_ALL); - } - gui_wps_statusbar_draw(gwps, false); - - return retcode; - } - if (gwps->state->id3) - gui_wps_refresh(gwps, 0, WPS_REFRESH_NON_STATIC); + { + if (cuesheet_is_enabled() && gwps->state->id3->cuesheet_type + && (gwps->state->id3->elapsed < curr_cue->curr_track->offset + || (curr_cue->curr_track_idx < curr_cue->track_count - 1 + && gwps->state->id3->elapsed >= (curr_cue->curr_track+1)->offset))) + { + /* We've changed tracks within the cuesheet : + we need to update the ID3 info and refresh the WPS */ + + cue_find_current_track(curr_cue, gwps->state->id3->elapsed); + cue_spoof_id3(curr_cue, gwps->state->id3); + + gwps->display->stop_scroll(); + if (gui_wps_display()) + retcode = true; + else + gui_wps_refresh(gwps, 0, WPS_REFRESH_ALL); + } + else + gui_wps_refresh(gwps, 0, WPS_REFRESH_NON_STATIC); + } gui_wps_statusbar_draw(gwps, false);