13
0

startup: fix logic/design error that led to deep errors

The old state in this commit would lead to an existing session
being loaded with the claim that it was a new session. This went
unnoticed until 4bed642d71, where newness impacted the time
domain of the session (and actually led to it being set to a random memory
value).
This commit is contained in:
Paul Davis 2023-09-18 16:25:51 -06:00
parent 9dd50d4536
commit bc91ea3c42

View File

@ -556,13 +556,24 @@ StartupFSM::get_session_parameters_from_command_line (bool new_session_required)
}
bool
StartupFSM::get_session_parameters_from_path (string const & path, string const & template_name, bool new_session_required)
StartupFSM::get_session_parameters_from_path (string const & path_, string const & template_name, bool new_session_required)
{
if (path.empty()) {
if (path_.empty()) {
/* use GUI to ask the user */
return false;
}
string path (path_);
/* ... did the user give us a path or just a name? */
if (path.find (G_DIR_SEPARATOR) == string::npos) {
/* user gave session name with no path info, use
default session folder.
*/
path = Glib::build_filename (Config->get_default_session_parent_dir (), path);
}
if (Glib::file_test (path.c_str(), Glib::FILE_TEST_EXISTS)) {
session_is_new = false;
@ -613,21 +624,10 @@ StartupFSM::get_session_parameters_from_path (string const & path, string const
}
/* Everything after this involves a new session
*
* ... did the user give us a path or just a name?
*/
/* Everything after this involves a new session */
if (path.find (G_DIR_SEPARATOR) == string::npos) {
/* user gave session name with no path info, use
default session folder.
*/
session_name = ARDOUR_COMMAND_LINE::session_name;
session_path = Glib::build_filename (Config->get_default_session_parent_dir (), session_name);
} else {
session_name = basename_nosuffix (path);
session_path = path;
}
session_name = basename_nosuffix (path);
session_path = path;
session_template = string ();