From 4cb3f9d177aa71a2747f0335e8db87a5455f8478 Mon Sep 17 00:00:00 2001 From: Jonas Kvinge Date: Sun, 11 Jul 2021 00:45:30 +0200 Subject: [PATCH] Close files in song loader --- src/core/songloader.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/core/songloader.cpp b/src/core/songloader.cpp index 545cffcfa..4f4cf4149 100644 --- a/src/core/songloader.cpp +++ b/src/core/songloader.cpp @@ -286,6 +286,7 @@ SongLoader::Result SongLoader::LoadLocalAsync(const QString &filename) { return Error; } QByteArray data(file.read(PlaylistParser::kMagicSize)); + file.close(); ParserBase *parser = playlist_parser_->ParserForMagic(data); if (!parser) { @@ -306,6 +307,7 @@ SongLoader::Result SongLoader::LoadLocalAsync(const QString &filename) { QFile cue(matching_cue); if (cue.open(QIODevice::ReadOnly)) { const SongList songs = cue_parser_->Load(&cue, matching_cue, QDir(filename.section('/', 0, -2))); + cue.close(); for (const Song &song : songs) { if (song.is_valid()) songs_ << song; } @@ -360,6 +362,7 @@ void SongLoader::LoadPlaylist(ParserBase *parser, const QString &filename) { QFile file(filename); file.open(QIODevice::ReadOnly); songs_ = parser->Load(&file, filename, QFileInfo(filename).path()); + file.close(); } static bool CompareSongs(const Song &left, const Song &right) {