grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
From: Vladimir Serbinenko <phcoder@gmail.com>
To: grub-devel@gnu.org
Cc: Vladimir Serbinenko <phcoder@gmail.com>
Subject: [PATCH 2/3] Don't attempt to do terminal functions on non-functional gfxterm
Date: Thu, 16 May 2024 22:34:43 +0300	[thread overview]
Message-ID: <20240516193444.4750-2-phcoder@gmail.com> (raw)
In-Reply-To: <20240516193444.4750-1-phcoder@gmail.com>

Attempting to do anything easily leads to a crash

Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com>
---
 grub-core/term/gfxterm.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/grub-core/term/gfxterm.c b/grub-core/term/gfxterm.c
index e8734a388..6513a529b 100644
--- a/grub-core/term/gfxterm.c
+++ b/grub-core/term/gfxterm.c
@@ -1038,6 +1038,9 @@ static void
 grub_gfxterm_gotoxy (struct grub_term_output *term __attribute__ ((unused)),
 		     struct grub_term_coordinate pos)
 {
+  if (!virtual_screen.functional)
+    return;
+
   if (pos.x >= virtual_screen.columns)
     pos.x = virtual_screen.columns - 1;
 
@@ -1072,6 +1075,9 @@ grub_gfxterm_cls (struct grub_term_output *term)
 {
   grub_video_color_t color;
 
+  if (!virtual_screen.functional)
+    return;
+
   /* Clear virtual screen.  */
   grub_virtual_screen_cls (term);
 
@@ -1118,6 +1124,9 @@ static void
 grub_gfxterm_setcursor (struct grub_term_output *term __attribute__ ((unused)),
 			int on)
 {
+  if (!virtual_screen.functional)
+    return;
+
   if (virtual_screen.cursor_state != on)
     {
       if (virtual_screen.cursor_state)
@@ -1132,6 +1141,9 @@ grub_gfxterm_setcursor (struct grub_term_output *term __attribute__ ((unused)),
 static void
 grub_gfxterm_refresh (struct grub_term_output *term __attribute__ ((unused)))
 {
+  if (!virtual_screen.functional)
+    return;
+
   real_scroll ();
 
   /* Redraw only changed regions.  */
-- 
2.39.2


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

  reply	other threads:[~2024-05-16 19:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-16 19:34 [PATCH 1/3] Decrease minimal gfxterm size to 10x6 Vladimir Serbinenko
2024-05-16 19:34 ` Vladimir Serbinenko [this message]
2024-05-16 19:34 ` [PATCH 3/3] grub_unicode_destroy_glyph: Don't destroy NULL glyph Vladimir Serbinenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240516193444.4750-2-phcoder@gmail.com \
    --to=phcoder@gmail.com \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).