From 48eaab4a4276c92f96366d4fbafd3eb5dedde2a7 Mon Sep 17 00:00:00 2001 From: mintsuki Date: Thu, 10 Mar 2022 18:21:49 +0100 Subject: [PATCH] term: Fix deinitialisation issues --- common/lib/term.c | 6 ++++-- common/protos/stivale2.c | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/common/lib/term.c b/common/lib/term.c index e3cdb326..4778befe 100644 --- a/common/lib/term.c +++ b/common/lib/term.c @@ -25,7 +25,9 @@ void term_deinit(void) { } void term_vbe(size_t width, size_t height) { - term_notready(); + if (term_backend != VBE) { + term_deinit(); + } if (quiet || allocations_disallowed) { return; @@ -349,7 +351,7 @@ void term_reinit(void) { #if bios == 1 void term_textmode(void) { - term_notready(); + term_deinit(); if (quiet || allocations_disallowed) { return; diff --git a/common/protos/stivale2.c b/common/protos/stivale2.c index 5035c390..9dc933a6 100644 --- a/common/protos/stivale2.c +++ b/common/protos/stivale2.c @@ -594,6 +594,8 @@ failed_to_load_header_section: fb = &_fb; } + term_deinit(); + if (hdrtag != NULL || (avtag != NULL && uefi) || (avtag != NULL && preference == 0)) { term_deinit();