prevent key press in pre-main-window dialog(s) from crashing the program because there is no editor window to forward key presses to

This commit is contained in:
Paul Davis 2013-09-12 14:39:17 -04:00
parent 6b3907d57f
commit 9a884535c3

View File

@ -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;
}