From e3e67438eab5c25a32e77977f8e83585bcb51579 Mon Sep 17 00:00:00 2001 From: sawinglogz <3787776-sawinglogz@users.noreply.gitlab.com> Date: Thu, 15 Aug 2019 16:28:07 -0400 Subject: [PATCH] Fix the incomplete cleanup in Profile::UnloadMachineData that was resulting in duplicate sessions being added when making preference changes to a brand new profile with existing data. Preference changes trigger a reload, see PreferencesDialog::Save and needs_reload, leading to MainWindow::reloadProfile -> MainWindow::CloseProfile -> Profile::UnloadMachineData. This is the root cause of the duplicate sessions, but the fact that it only happened with newly created profiles, rather than on subsequent launches, demonstrates an inconsistency in state of Profile. It should be identical when initially created and when loaded via subsequent application launch. --- oscar/SleepLib/profiles.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/oscar/SleepLib/profiles.cpp b/oscar/SleepLib/profiles.cpp index 34b5df54..7e16a07a 100644 --- a/oscar/SleepLib/profiles.cpp +++ b/oscar/SleepLib/profiles.cpp @@ -576,11 +576,6 @@ void Profile::DataFormatError(Machine *m) } void Profile::UnloadMachineData() { - if (!m_machopened) { - qCritical() << "Profile::UnloadMachineData() called with m_machopened==false"; - return; - } - for (auto & mach : m_machlist) { mach->saveSessionInfo(); mach->sessionlist.clear();