qemu-stable
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-stable] [PATCH 23/53] sdl2: fix crash in handle_windowevent() when


From: Michael Roth
Subject: [Qemu-stable] [PATCH 23/53] sdl2: fix crash in handle_windowevent() when restoring the screen size
Date: Thu, 30 Jul 2015 06:32:38 -0500

From: Alberto Garcia <address@hidden>

The Ctrl-Alt-u keyboard shortcut restores the screen to its original
size. In the SDL2 UI this is done by destroying the window and
creating a new one. The old window emits SDL_WINDOWEVENT_HIDDEN when
it's destroyed, but trying to call SDL_GetWindowFromID() from that
event's window ID returns a null pointer. handle_windowevent() assumes
that the pointer is never null so it results in a crash.

Cc: address@hidden
Signed-off-by: Alberto Garcia <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>
(cherry picked from commit 08d49df0dbaacc220a099dbfb644e1dc0eda57be)
Signed-off-by: Michael Roth <address@hidden>
---
 ui/sdl2.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/ui/sdl2.c b/ui/sdl2.c
index 60e3c3b..f10c6a4 100644
--- a/ui/sdl2.c
+++ b/ui/sdl2.c
@@ -511,6 +511,10 @@ static void handle_windowevent(SDL_Event *ev)
 {
     struct sdl2_console *scon = get_scon_from_window(ev->window.windowID);
 
+    if (!scon) {
+        return;
+    }
+
     switch (ev->window.event) {
     case SDL_WINDOWEVENT_RESIZED:
         {
-- 
1.9.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]