Commit d4dc1bee authored by Michael Pyne's avatar Michael Pyne

Ensure CollectionList cache is saved on shutdown.

JuK caches its list of collection list items for re-use on subsequent
startup, to reduce the time needed to wait for Taglib to rescan music
files that have been previously scanned (and presumably have not changed
outside of JuK). It also records the list of playlists on shutdown, including
playlists which are not accessible as M3U files.

Shutdown behavior has long been problematic for JuK as a Qt5 app due to
a) poor coding and b) changes in how close/quit event handling has
evolved since it's roots in KDE 3. I made some attempt at cleaning this
up with commit a951caf3, but that bug
fix fell short, as it did not ensure that JuK caches the collection and
records the list of playlists.

Most users would experience this as "merely" a performance hit on
startup.

The fix is to ensure the caching/state-saving code is called (as part of
GUI class destructors) by destructing the PlaylistSplitter class, which
had almost been working prior to a951caf3.

I did not see a directly applicable bug report.

CHANGELOG:Speedup JuK restarts by fixing bug preventing collection data from being saved on shutdown.
FIXED-IN:19.08.2
parent b9180d80
Pipeline #7312 passed with stage
in 5 minutes and 34 seconds
......@@ -176,19 +176,17 @@ JuK::JuK(const QStringList &filesToOpen, QWidget *parent) :
JuK::~JuK()
{
if(!m_shuttingDown) {
// Sometimes KMainWindow doesn't actually call QCoreApplication::quit
// after queryClose, even if not in a session shutdown, so make sure to
// do so ourselves when closing the main window.
slotQuit();
}
// Some items need to be deleted before others, though I haven't looked
// at this in some time so refinement is probably possible.
delete m_systemTray;
delete m_splitter;
delete m_player;
delete m_statusLabel;
// Sometimes KMainWindow doesn't actually call QCoreApplication::quit
// after queryClose, even if not in a session shutdown, so make sure to
// do so ourselves when closing the main window.
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
}
JuK* JuK::JuKInstance()
......@@ -582,7 +580,18 @@ void JuK::slotQuit()
m_startDocked = !isVisible();
saveConfig();
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
// this will start chain of events causing PlaylistCollection (in
// guise of PlaylistBox) and CollectionList (as first Playlist child)
// to save themselves and then quit the application when this widget
// closes.
delete m_statusLabel;
m_statusLabel = nullptr;
delete m_splitter;
m_splitter = nullptr;
setAttribute(Qt::WA_DeleteOnClose);
this->close();
}
////////////////////////////////////////////////////////////////////////////////
......
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