From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KGvp9-0006Ct-W0 for qemu-devel@nongnu.org; Thu, 10 Jul 2008 09:04:40 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KGvp7-0006CN-Sk for qemu-devel@nongnu.org; Thu, 10 Jul 2008 09:04:39 -0400 Received: from [199.232.76.173] (port=57820 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KGvp7-0006CD-PZ for qemu-devel@nongnu.org; Thu, 10 Jul 2008 09:04:37 -0400 Received: from il.qumranet.com ([212.179.150.194]:53558) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KGvp7-0006Pn-3i for qemu-devel@nongnu.org; Thu, 10 Jul 2008 09:04:37 -0400 From: Avi Kivity Date: Thu, 10 Jul 2008 16:04:33 +0300 Message-Id: <1215695074-8939-2-git-send-email-avi@qumranet.com> In-Reply-To: <1215695074-8939-1-git-send-email-avi@qumranet.com> References: <1215695074-8939-1-git-send-email-avi@qumranet.com> Subject: [Qemu-devel] [PATCH 1/2] fix vga screendump Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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 --- 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