aboutsummaryrefslogtreecommitdiff
path: root/src/qmmpui/fileloader.cpp
diff options
context:
space:
mode:
authortrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2019-09-08 11:49:28 +0000
committertrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2019-09-08 11:49:28 +0000
commit463f4e95cff0e100b4c8c8b5378cfe1b2604c138 (patch)
treecb73da70a910165d5715d6fc20c11587454c4133 /src/qmmpui/fileloader.cpp
parent1e31fe896524513577911e382897b841e40a4814 (diff)
downloadqmmp-463f4e95cff0e100b4c8c8b5378cfe1b2604c138.tar.gz
qmmp-463f4e95cff0e100b4c8c8b5378cfe1b2604c138.tar.bz2
qmmp-463f4e95cff0e100b4c8c8b5378cfe1b2604c138.zip
fixed possible regressions
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@9068 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/qmmpui/fileloader.cpp')
-rw-r--r--src/qmmpui/fileloader.cpp43
1 files changed, 25 insertions, 18 deletions
diff --git a/src/qmmpui/fileloader.cpp b/src/qmmpui/fileloader.cpp
index e4f557ac6..a03bb18c7 100644
--- a/src/qmmpui/fileloader.cpp
+++ b/src/qmmpui/fileloader.cpp
@@ -45,7 +45,7 @@ FileLoader::~FileLoader()
QList<PlayListTrack *> FileLoader::processFile(const QString &path, QStringList *ignoredPaths)
{
QList<PlayListTrack *> tracks;
- QList <TrackInfo *> infoList = MetaDataManager::instance()->createPlayList(path, m_parts, ignoredPaths);
+ const QList<TrackInfo *> infoList = MetaDataManager::instance()->createPlayList(path, m_parts, ignoredPaths);
for(TrackInfo *info : qAsConst(infoList))
{
@@ -132,27 +132,25 @@ void FileLoader::insertPlayList(const QString &path, PlayListItem *before)
filters << QRegExp(pattern, Qt::CaseInsensitive, QRegExp::Wildcard);
- for(PlayListTrack *t : qAsConst(tracks))
+ QList<PlayListTrack *>::iterator it = tracks.begin();
+ while(it != tracks.end())
{
- if(t->path().contains("://"))
+ if((*it)->path().contains("://") && !protocols.contains((*it)->path().section("://", 0, 0)))
{
- if(!protocols.contains(t->path().section("://",0,0)))
- {
- tracks.removeAll(t);
- delete t;
- }
+ delete (*it);
+ it = tracks.erase(it);
}
- else if(!QFile::exists(t->path()))
+ else if(!QFile::exists((*it)->path()))
{
- tracks.removeAll(t);
- delete t;
+ delete (*it);
+ it = tracks.erase(it);
}
else
{
bool found = false;
for(const QRegExp &filter : qAsConst(filters))
{
- if(filter.exactMatch(t->path()))
+ if(filter.exactMatch((*it)->path()))
{
found = true;
break;
@@ -160,8 +158,12 @@ void FileLoader::insertPlayList(const QString &path, PlayListItem *before)
}
if(!found)
{
- tracks.removeAll(t);
- delete t;
+ delete (*it);
+ it = tracks.erase(it);
+ }
+ else
+ {
+ ++it;
}
}
}
@@ -384,12 +386,17 @@ void FileLoader::removeIgnoredTracks(QList<PlayListTrack *> *tracks, const QStri
if(ignoredPaths.isEmpty())
return;
- for(PlayListTrack *track : qAsConst(*tracks))
+ QList<PlayListTrack *>::iterator it = tracks->begin();
+ while(it != tracks->end())
{
- if(ignoredPaths.contains(track->path()))
+ if(ignoredPaths.contains((*it)->path()))
+ {
+ delete (*it);
+ it = tracks->erase(it);
+ }
+ else
{
- tracks->removeAll(track);
- delete track;
+ ++it;
}
}
}