]> Git Repo - qemu.git/commitdiff
sdl: Fix crash when calling sdl_switch() with NULL surface
authorBenjamin Herrenschmidt <[email protected]>
Mon, 7 Jul 2014 05:11:22 +0000 (15:11 +1000)
committerGerd Hoffmann <[email protected]>
Thu, 12 Mar 2015 11:54:23 +0000 (12:54 +0100)
This happens for example when doing ctrl-alt-u and segfaults

Signed-off-by: Benjamin Herrenschmidt <[email protected]>
Signed-off-by: Gerd Hoffmann <[email protected]>
ui/sdl.c

index b89182a2c0fd8c0a1bf46e38cc74d67d992b57e7..8bdbf521d1067ef498f35abce7403fe0a662e808 100644 (file)
--- 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);
This page took 0.027474 seconds and 4 git commands to generate.