From d5f3cc6ec2d21eadf75184c8f837f53599be6c9c Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Tue, 26 Nov 2024 15:40:49 +0100 Subject: [PATCH] terminal: ignore input without valid GUI mode This prevents the potential corner case where the terminal receives input at a time when the window has no valid size and _text_screen_surface is not constructed. --- repos/gems/src/server/terminal/main.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/repos/gems/src/server/terminal/main.cc b/repos/gems/src/server/terminal/main.cc index fc66fbf7ff..c6ff2a1217 100644 --- a/repos/gems/src/server/terminal/main.cc +++ b/repos/gems/src/server/terminal/main.cc @@ -364,6 +364,9 @@ void Terminal::Main::_handle_config() void Terminal::Main::_handle_input() { + if (!_text_screen_surface.constructed()) + return; + _gui.input.for_each_event([&] (Input::Event const &event) { event.handle_absolute_motion([&] (int x, int y) { @@ -485,7 +488,7 @@ void Terminal::Main::_handle_input() void Terminal::Main::_report_clipboard_selection() { - if (!_clipboard_reporter.constructed()) + if (!_text_screen_surface.constructed() || !_clipboard_reporter.constructed()) return; _clipboard_reporter->generate([&] (Xml_generator &xml) {