From 9a884535c39867b7822221406f3f2630e3b95f2a Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Thu, 12 Sep 2013 14:39:17 -0400 Subject: prevent key press in pre-main-window dialog(s) from crashing the program because there is no editor window to forward key presses to --- gtk2_ardour/utils.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'gtk2_ardour/utils.cc') diff --git a/gtk2_ardour/utils.cc b/gtk2_ardour/utils.cc index 8b05eb7108..1b87a3d444 100644 --- a/gtk2_ardour/utils.cc +++ b/gtk2_ardour/utils.cc @@ -363,8 +363,15 @@ set_color (Gdk::Color& c, int rgb) bool relay_key_press (GdkEventKey* ev, Gtk::Window* win) { + PublicEditor& ed (PublicEditor::instance()); + + if (&ed == 0) { + /* early key press in pre-main-window-dialogs, no editor yet */ + return false; + } + if (!key_press_focus_accelerator_handler (*win, ev)) { - return PublicEditor::instance().on_key_press_event(ev); + return ed.on_key_press_event(ev); } else { return true; } -- cgit v1.2.3