Don't clear selection during session load

Mouse-mode is set after the the session sets CoreSelection
in the backend, and can clear valid selection.

Note: Region Selection (if any) is saved in instant.xml
and set during first_idle, which usually still happens
from `load_session_stage_two() -> flush_pending()`.
This commit is contained in:
Robin Gareus 2025-09-08 23:30:06 +02:00
parent 74133432d3
commit e4ef7fca8f
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04
4 changed files with 11 additions and 0 deletions

View file

@ -349,6 +349,7 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir)
, recorder_visibility_button (S_("Window|Rec"))
, trigger_page_visibility_button (S_("Window|Cue"))
, nsm_first_session_opened (false)
, _loading_session (false)
{
Gtkmm2ext::init (localedir);

View file

@ -257,6 +257,8 @@ public:
bool ask_about_loading_existing_session (const std::string& session_path);
int load_session_from_startup_fsm ();
bool loading_session () const { return _loading_session; }
/// @return true if session was successfully unloaded.
int unload_session (bool hide_stuff = false, bool force_unload = false);
void close_session();
@ -874,6 +876,8 @@ private:
void ask_about_scratch_deletion ();
bool nsm_first_session_opened;
bool _loading_session;
PBD::ScopedConnectionList clock_state_connection;
};

View file

@ -404,6 +404,8 @@ ARDOUR_UI::audio_midi_setup_reconfigure_done (int response, std::string path, st
int
ARDOUR_UI::load_session_stage_two (const std::string& path, const std::string& snap_name, std::string mix_template)
{
PBD::Unwinder uw (_loading_session, true);
Session *new_session;
int retval = -1;

View file

@ -244,6 +244,10 @@ Editor::internal_editing() const
void
Editor::update_time_selection_display ()
{
if (ARDOUR_UI::instance()->loading_session ()) {
/* leave selection alone */
return;
}
auto mouse_mode = current_mouse_mode ();
switch (mouse_mode) {
case MouseRange: