Commit f4401608 authored by Michael Pyne's avatar Michael Pyne
Browse files

playlist: Move M3U-based file loading to happen after ctor runs.

This is another bug detected by LGTM

`loadFile()` itself calls at least four virtual methods. Rather than
trying to de-virtualize them as I did in the last fix, I decided to just
have the file load happen after the class is fully constructed, using
the Qt event loop.
parent a800c1b3
......@@ -151,8 +151,13 @@ Playlist::Playlist(PlaylistCollection *collection, const QFileInfo &playlistFile
: Playlist(true, QString(), collection, iconName, 0)
m_fileName = playlistFile.canonicalFilePath();
loadFile(m_fileName, playlistFile);
collection->setupPlaylist(this, iconName);
// Load the file after construction completes so that virtual methods in
// subclasses can take effect.
QTimer::singleShot(0, [=]() {
loadFile(m_fileName, playlistFile);
collection->setupPlaylist(this, iconName);
Playlist::Playlist(PlaylistCollection *collection, bool delaySetup, int extraColumns)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment