From 4b1d2b7ac82a2840982b7c1e9ff8363150e59963 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Tue, 28 Oct 2025 19:29:01 +0100 Subject: [PATCH] Fix crash at start when rulers-follow-grid is enabled When creating the editor, default modes are set, this toggles mouse-modes, in `Editor::mouse_mode_chosen` which in turn calls EditingContext::grid_type_chosen. With rulers-follow-grid enabled this can call `Editor::toggle_ruler_visibility`. Since `_session` is NULL during editor's c-tor this caused a crash in `Editor::store_ruler_visibility`. --- gtk2_ardour/editor.cc | 5 ++++- gtk2_ardour/editor_actions.cc | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 1510090e5a..fc407a70ce 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -660,7 +660,10 @@ Editor::Editor () setup_toolbar (); - set_action_defaults (); + { + PBD::Unwinder uw (no_ruler_shown_update, true); + set_action_defaults (); + } ARDOUR_UI::instance()->ActionsReady.connect_same_thread (*this, std::bind (&Editor::initialize_ruler_actions, this)); diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc index e601cd5180..e7ce4fd890 100644 --- a/gtk2_ardour/editor_actions.cc +++ b/gtk2_ardour/editor_actions.cc @@ -777,6 +777,8 @@ Editor::toggle_ruler_visibility () return; } + assert (_session); + update_ruler_visibility (); store_ruler_visibility (); }