qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 1/2] fix vga screendump


From: Avi Kivity
Subject: [Qemu-devel] [PATCH 1/2] fix vga screendump
Date: Thu, 10 Jul 2008 16:04:33 +0300

Commit 4812 ("Implement resolution switching in common console code")
uses qemu_console_resize() instead of dpy_resize().  This means console->ds
is examined instead of the VGA private ds, and the resize does not take place,
leading to a segfault.

Fix by modifying the DisplayState directly rather than swapping the pointer.

Signed-off-by: Avi Kivity <address@hidden>
---
 hw/vga.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/hw/vga.c b/hw/vga.c
index 5a3203c..0e3ccf3 100644
--- a/hw/vga.c
+++ b/hw/vga.c
@@ -2281,11 +2281,11 @@ int ppm_save(const char *filename, uint8_t *data,
 static void vga_screen_dump(void *opaque, const char *filename)
 {
     VGAState *s = (VGAState *)opaque;
-    DisplayState *saved_ds, ds1, *ds = &ds1;
+    DisplayState saved_ds, *ds = s->ds;
 
     /* XXX: this is a little hackish */
     vga_invalidate_display(s);
-    saved_ds = s->ds;
+    saved_ds = *s->ds;
 
     memset(ds, 0, sizeof(DisplayState));
     ds->dpy_update = vga_save_dpy_update;
@@ -2293,7 +2293,6 @@ static void vga_screen_dump(void *opaque, const char 
*filename)
     ds->dpy_refresh = vga_save_dpy_refresh;
     ds->depth = 32;
 
-    s->ds = ds;
     s->graphic_mode = -1;
     vga_update_display(s);
 
@@ -2302,5 +2301,5 @@ static void vga_screen_dump(void *opaque, const char 
*filename)
                  s->ds->linesize);
         qemu_free(ds->data);
     }
-    s->ds = saved_ds;
+    *s->ds = saved_ds;
 }
-- 
1.5.6.1





reply via email to

[Prev in Thread] Current Thread [Next in Thread]