qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Avi Kivity <avi@qumranet.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 1/2] fix vga screendump
Date: Thu, 10 Jul 2008 16:04:33 +0300	[thread overview]
Message-ID: <1215695074-8939-2-git-send-email-avi@qumranet.com> (raw)
In-Reply-To: <1215695074-8939-1-git-send-email-avi@qumranet.com>

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 <avi@qumranet.com>
---
 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	other threads:[~2008-07-10 13:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-10 13:04 [Qemu-devel] [PATCH 0/2] Fix the monitor 'screendump' command Avi Kivity
2008-07-10 13:04 ` Avi Kivity [this message]
2008-07-10 13:04 ` [Qemu-devel] [PATCH 2/2] fix screendump with multiple consoles Avi Kivity
2008-07-10 13:20 ` [Qemu-devel] Re: [PATCH 0/2] Fix the monitor 'screendump' command Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1215695074-8939-2-git-send-email-avi@qumranet.com \
    --to=avi@qumranet.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).