:: commit 48eaab4a4276c92f96366d4fbafd3eb5dedde2a7

mintsuki <mintsuki@protonmail.com> — 2022-03-10 17:21

parents: 26acbb8bd9

term: Fix deinitialisation issues

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();
 
tab: 248 wrap: offon