From 4fa60739f2b9f7230e272c7851dfb4edc702ee11 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Thu, 3 Oct 2013 23:32:19 +0200 Subject: [PATCH] * grub-core/term/gfxterm.c: Add flag "functional" to skip input when changing windows to avoid crash. --- ChangeLog | 5 +++++ grub-core/term/gfxterm.c | 13 ++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 0a3da2a46..484faa053 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-10-03 Vladimir Serbinenko + + * grub-core/term/gfxterm.c: Add flag "functional" to skip input when + changing windows to avoid crash. + 2013-10-03 Vladimir Serbinenko * grub-core/kern/arm/cache.c: Add v5 write-through cache support. diff --git a/grub-core/term/gfxterm.c b/grub-core/term/gfxterm.c index e7806b92c..e7d5af4e8 100644 --- a/grub-core/term/gfxterm.c +++ b/grub-core/term/gfxterm.c @@ -97,6 +97,8 @@ struct grub_virtual_screen struct grub_colored_char *text_buffer; int total_scroll; + + int functional; }; struct grub_gfxterm_window @@ -178,6 +180,8 @@ clear_char (struct grub_colored_char *c) static void grub_virtual_screen_free (void) { + virtual_screen.functional = 0; + /* If virtual screen has been allocated, free it. */ if (virtual_screen.text_buffer != 0) { @@ -264,8 +268,12 @@ grub_virtual_screen_setup (unsigned int x, unsigned int y, virtual_screen.text_buffer[i].code.ncomb = 0; clear_char (&(virtual_screen.text_buffer[i])); } + if (grub_errno) + return grub_errno; - return grub_errno; + virtual_screen.functional = 1; + + return GRUB_ERR_NONE; } void @@ -814,6 +822,9 @@ static void grub_gfxterm_putchar (struct grub_term_output *term, const struct grub_unicode_glyph *c) { + if (!virtual_screen.functional) + return; + if (c->base == '\a') /* FIXME */ return;