From d60a6a890dd26dac99edcca2cae7e5c50f98c6fe Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 7 Jul 2021 04:34:28 +0200 Subject: [PATCH] Fix gtk assert on key-propagation This can happen when starting Ardour with the Preference pane as initial tab. The editor, mixer are not realized, so -propagation fails with: IA__gtk_widget_event: assertion 'WIDGET_REALIZED_FOR_EVENT (widget, event)' failed --- gtk2_ardour/ardour_ui_keys.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gtk2_ardour/ardour_ui_keys.cc b/gtk2_ardour/ardour_ui_keys.cc index 81c46a6767..da1fed3aed 100644 --- a/gtk2_ardour/ardour_ui_keys.cc +++ b/gtk2_ardour/ardour_ui_keys.cc @@ -236,7 +236,7 @@ ARDOUR_UI::key_press_focus_accelerator_handler (Gtk::Window& window, GdkEventKey DEBUG_TRACE (DEBUG::Accelerators, "\tnot handled by binding activation, now propagate to window\n"); - if (gtk_window_propagate_key_event (win, ev)) { + if (window.get_realized () && (!window.get_focus() || window.get_focus()->get_realized ()) && gtk_window_propagate_key_event (win, ev)) { DEBUG_TRACE (DEBUG::Accelerators, "\tpropagate handled\n"); return true; } @@ -247,7 +247,7 @@ ARDOUR_UI::key_press_focus_accelerator_handler (Gtk::Window& window, GdkEventKey DEBUG_TRACE (DEBUG::Accelerators, "\tpropagate, then activate\n"); - if (gtk_window_propagate_key_event (win, ev)) { + if (window.get_realized () && (!window.get_focus() || window.get_focus()->get_realized ()) && gtk_window_propagate_key_event (win, ev)) { DEBUG_TRACE (DEBUG::Accelerators, "\thandled by propagate\n"); return true; }