diff options
author | Alberto Garcia <berto@igalia.com> | 2015-06-08 11:12:15 +0200 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2015-06-09 10:25:21 +0200 |
commit | 08d49df0dbaacc220a099dbfb644e1dc0eda57be (patch) | |
tree | b9cfaffd539431a0fff4c562dd081019eb068a34 /ui | |
parent | ee09f84e6bf5383a23c9624115c26b72aa1e076c (diff) |
sdl2: fix crash in handle_windowevent() when restoring the screen size
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: qemu-stable@nongnu.org
Signed-off-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'ui')
-rw-r--r-- | ui/sdl2.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -521,6 +521,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: { |