diff options
author | Magnus Holmgren <magnushol@gmail.com> | 2010-08-11 19:01:50 +0000 |
---|---|---|
committer | Magnus Holmgren <magnushol@gmail.com> | 2010-08-11 19:01:50 +0000 |
commit | 113764d9c0dad33beab8ece9a9073c8648bd9da6 (patch) | |
tree | 3411fcb376adcbcb15ec3dc37bc95bb698af7ace /apps/tree.c | |
parent | de44ae7efcf907c8aa52475a7c0dd9f0da22045e (diff) | |
download | rockbox-113764d9c0dad33beab8ece9a9073c8648bd9da6.tar.gz rockbox-113764d9c0dad33beab8ece9a9073c8648bd9da6.zip |
Fix FS#11175. playlist_peek() wasn't thread safe (due to a static filename buffer), so frequent calls from the main thread would cause the audio thread to buffer the wrong track.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27773 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/tree.c')
-rw-r--r-- | apps/tree.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/apps/tree.c b/apps/tree.c index c2ec4ca3ec..f8874f684e 100644 --- a/apps/tree.c +++ b/apps/tree.c | |||
@@ -1075,6 +1075,7 @@ bool bookmark_play(char *resume_file, int index, int offset, int seed, | |||
1075 | lastdir[0]='\0'; | 1075 | lastdir[0]='\0'; |
1076 | if (playlist_create(resume_file, NULL) != -1) | 1076 | if (playlist_create(resume_file, NULL) != -1) |
1077 | { | 1077 | { |
1078 | char filename_buf[MAX_PATH + 1]; | ||
1078 | const char* peek_filename; | 1079 | const char* peek_filename; |
1079 | resume_directory(resume_file); | 1080 | resume_directory(resume_file); |
1080 | if (global_settings.playlist_shuffle) | 1081 | if (global_settings.playlist_shuffle) |
@@ -1082,13 +1083,15 @@ bool bookmark_play(char *resume_file, int index, int offset, int seed, | |||
1082 | 1083 | ||
1083 | /* Check if the file is at the same spot in the directory, | 1084 | /* Check if the file is at the same spot in the directory, |
1084 | else search for it */ | 1085 | else search for it */ |
1085 | peek_filename = playlist_peek(index); | 1086 | peek_filename = playlist_peek(index, filename_buf, |
1087 | sizeof(filename_buf)); | ||
1086 | 1088 | ||
1087 | if (peek_filename == NULL) | 1089 | if (peek_filename == NULL) |
1088 | { | 1090 | { |
1089 | /* playlist has shrunk, search from the top */ | 1091 | /* playlist has shrunk, search from the top */ |
1090 | index = 0; | 1092 | index = 0; |
1091 | peek_filename = playlist_peek(index); | 1093 | peek_filename = playlist_peek(index, filename_buf, |
1094 | sizeof(filename_buf)); | ||
1092 | if (peek_filename == NULL) | 1095 | if (peek_filename == NULL) |
1093 | return false; | 1096 | return false; |
1094 | } | 1097 | } |
@@ -1097,7 +1100,8 @@ bool bookmark_play(char *resume_file, int index, int offset, int seed, | |||
1097 | { | 1100 | { |
1098 | for ( i=0; i < playlist_amount(); i++ ) | 1101 | for ( i=0; i < playlist_amount(); i++ ) |
1099 | { | 1102 | { |
1100 | peek_filename = playlist_peek(i); | 1103 | peek_filename = playlist_peek(i, filename_buf, |
1104 | sizeof(filename_buf)); | ||
1101 | 1105 | ||
1102 | if (peek_filename == NULL) | 1106 | if (peek_filename == NULL) |
1103 | return false; | 1107 | return false; |