Skip to contentSkip to conversation

gtk: Don't crash if -nodefaults

PATCH In review Fam Zheng 2 participants 2 messages Nov 21, 2014

lore
Share & tools
lore

Fam Zheng

author
#0 lore raw

PATCH 1/1 gtk: Don't crash if -nodefaults

This fixes a crash by just skipping the vte resize hack if cur is NULL.

Reproducer:

qemu-system-x86_64 -nodefaults

---
 ui/gtk.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
ui/gtk.c +9 -7
index 38bf463..29e09a7 100644
@@ -1910,15 +1910,17 @@ void gtk_display_init(DisplayState *ds, bool full_screen, bool grab_on_hover)
 #ifdef VTE_RESIZE_HACK
     {
         VirtualConsole *cur = gd_vc_find_current(s);
-        int i;
-
-        for (i = 0; i < s->nb_vcs; i++) {
-            VirtualConsole *vc = &s->vc[i];
-            if (vc && vc->type == GD_VC_VTE && vc != cur) {
-                gtk_widget_hide(vc->vte.terminal);
+        if (cur) {
+            int i;
+
+            for (i = 0; i < s->nb_vcs; i++) {
+                VirtualConsole *vc = &s->vc[i];
+                if (vc && vc->type == GD_VC_VTE && vc != cur) {
+                    gtk_widget_hide(vc->vte.terminal);
+                }
             }
+            gd_update_windowsize(cur);
         }
-        gd_update_windowsize(cur);
     }
 #endif
 
Signature · 1 line
1.9.3
#1 lore raw
Quoted 2 lines · Fam Zheng

This fixes a crash by just skipping the vte resize hack if cur is NULL.

Picked up for 2.2.

thanks,
Gerd