aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2014-07-07 15:11:22 +1000
committerGerd Hoffmann <kraxel@redhat.com>2015-03-12 12:54:23 +0100
commitd28d6505bd72f0d6e3e7a968c60c27f893da976e (patch)
tree8fde1da56a7e4e1682549324159ae80c28fe4951
parent5f5d82ddf1789d32d8921c022261be59e4dcd283 (diff)
sdl: Fix crash when calling sdl_switch() with NULL surface
This happens for example when doing ctrl-alt-u and segfaults Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
-rw-r--r--ui/sdl.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/ui/sdl.c b/ui/sdl.c
index b89182a2c0..8bdbf521d1 100644
--- a/ui/sdl.c
+++ b/ui/sdl.c
@@ -135,12 +135,13 @@ static void do_sdl_resize(int width, int height, int bpp)
static void sdl_switch(DisplayChangeListener *dcl,
DisplaySurface *new_surface)
{
- PixelFormat pf = qemu_pixelformat_from_pixman(new_surface->format);
+ PixelFormat pf;
/* temporary hack: allows to call sdl_switch to handle scaling changes */
if (new_surface) {
surface = new_surface;
}
+ pf = qemu_pixelformat_from_pixman(surface->format);
if (!scaling_active) {
do_sdl_resize(surface_width(surface), surface_height(surface), 0);