qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>,
	Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>,
	Maria Klimushenkova <maria.klimushenkova@ispras.ru>
Subject: [Qemu-devel] [PULL 3/3] sdl2: add checking for NULL
Date: Tue, 26 Jun 2018 15:56:25 +0200	[thread overview]
Message-ID: <20180626135625.7078-4-kraxel@redhat.com> (raw)
In-Reply-To: <20180626135625.7078-1-kraxel@redhat.com>

From: Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>

Sometimes SDL2 console can't be retrieved on events and scon variable
becomes NULL. This patch prevents processing of the events when the console
is not available.

Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>
Signed-off-by: Maria Klimushenkova <maria.klimushenkova@ispras.ru>
Message-id: 20180626064729.18070.47600.stgit@pasha-VirtualBox
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/sdl2.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/ui/sdl2.c b/ui/sdl2.c
index 3fff9f5b63..76e59427cc 100644
--- a/ui/sdl2.c
+++ b/ui/sdl2.c
@@ -438,7 +438,7 @@ static void handle_mousemotion(SDL_Event *ev)
     int max_x, max_y;
     struct sdl2_console *scon = get_scon_from_window(ev->motion.windowID);
 
-    if (!qemu_console_is_graphic(scon->dcl.con)) {
+    if (!scon || !qemu_console_is_graphic(scon->dcl.con)) {
         return;
     }
 
@@ -470,7 +470,7 @@ static void handle_mousebutton(SDL_Event *ev)
     SDL_MouseButtonEvent *bev;
     struct sdl2_console *scon = get_scon_from_window(ev->button.windowID);
 
-    if (!qemu_console_is_graphic(scon->dcl.con)) {
+    if (!scon || !qemu_console_is_graphic(scon->dcl.con)) {
         return;
     }
 
@@ -496,7 +496,7 @@ static void handle_mousewheel(SDL_Event *ev)
     SDL_MouseWheelEvent *wev = &ev->wheel;
     InputButton btn;
 
-    if (!qemu_console_is_graphic(scon->dcl.con)) {
+    if (!scon || !qemu_console_is_graphic(scon->dcl.con)) {
         return;
     }
 
-- 
2.9.3

  parent reply	other threads:[~2018-06-26 13:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-26 13:56 [Qemu-devel] [PULL 0/3] Ui 20180626 patches Gerd Hoffmann
2018-06-26 13:56 ` [Qemu-devel] [PULL 1/3] Add gles support to egl-helpers, wire up in egl-headless and gtk Gerd Hoffmann
2018-06-26 13:56 ` [Qemu-devel] [PULL 2/3] sdl2: fix copypaste issues Gerd Hoffmann
2018-06-26 13:56 ` Gerd Hoffmann [this message]
2018-06-26 16:37 ` [Qemu-devel] [PULL 0/3] Ui 20180626 patches Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180626135625.7078-4-kraxel@redhat.com \
    --to=kraxel@redhat.com \
    --cc=Pavel.Dovgaluk@ispras.ru \
    --cc=maria.klimushenkova@ispras.ru \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).