aboutsummaryrefslogtreecommitdiff
path: root/ui/gtk.c
diff options
context:
space:
mode:
authorFam Zheng <famz@redhat.com>2014-11-21 09:59:09 +0800
committerGerd Hoffmann <kraxel@redhat.com>2014-11-21 08:37:59 +0100
commitb310a2a6095ec927a42cc1aba520a316be0faf51 (patch)
treed57daeed231b0c39f116512d90a3b36179e20859 /ui/gtk.c
parent8a0f9b5263bb3a96d574ca78ad3b8f1d7bf8b12b (diff)
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 Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'ui/gtk.c')
-rw-r--r--ui/gtk.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/ui/gtk.c b/ui/gtk.c
index 9496b8d24f..0385757bf5 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -1909,15 +1909,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