From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34189) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YVydW-0004ce-SJ for qemu-devel@nongnu.org; Thu, 12 Mar 2015 04:38:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YVydV-0004eo-G0 for qemu-devel@nongnu.org; Thu, 12 Mar 2015 04:38:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41823) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YVydV-0004ei-8h for qemu-devel@nongnu.org; Thu, 12 Mar 2015 04:38:33 -0400 From: Gerd Hoffmann Date: Thu, 12 Mar 2015 09:38:13 +0100 Message-Id: <1426149496-6043-3-git-send-email-kraxel@redhat.com> In-Reply-To: <1426149496-6043-1-git-send-email-kraxel@redhat.com> References: <1426149496-6043-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PULL v2 2/5] sdl: Fix crash when calling sdl_switch() with NULL surface List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Anthony Liguori From: Benjamin Herrenschmidt This happens for example when doing ctrl-alt-u and segfaults Signed-off-by: Benjamin Herrenschmidt Signed-off-by: Gerd Hoffmann --- ui/sdl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ui/sdl.c b/ui/sdl.c index b89182a..8bdbf52 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); -- 1.8.3.1