From df2ac3cc12d251dcdd268038682fd27882e91bb2 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Tue, 7 Apr 2020 11:36:17 +0200 Subject: ui: improve -show-cursor deprecation message Specifically explain what users should do in case they don't use -display yet and depend on the qemu picking the ui for them. Signed-off-by: Gerd Hoffmann Message-id: 20200407093617.10058-1-kraxel@redhat.com --- softmmu/vl.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/softmmu/vl.c b/softmmu/vl.c index afd2615..63eeb6a 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -3531,8 +3531,10 @@ void qemu_init(int argc, char **argv, char **envp) no_shutdown = 1; break; case QEMU_OPTION_show_cursor: - warn_report("The -show-cursor option is deprecated, " - "use -display {sdl,gtk},show-cursor=on instead"); + warn_report("The -show-cursor option is deprecated. Please " + "add show-cursor=on to your -display options."); + warn_report("When using the default display you can use " + "-display default,show-cursor=on"); dpy.has_show_cursor = true; dpy.show_cursor = true; break; -- cgit v1.1 From 32ec9839d89d2b814ada20b041b25feae23596bc Mon Sep 17 00:00:00 2001 From: Changbin Du Date: Mon, 27 Apr 2020 21:24:12 +0800 Subject: ui/sdl2: fix segment fault caused by null pointer dereference I found SDL_GetWindowFromID() sometimes return NULL when I start qemu via ssh forwarding even the window has been crated already. I am not sure whether this is a bug of SDL, but we'd better check it carefully. Signed-off-by: Changbin Du Message-id: 20200427132412.17909-1-changbin.du@gmail.com Signed-off-by: Gerd Hoffmann --- ui/sdl2.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ui/sdl2.c b/ui/sdl2.c index 3c9424e..61c7956 100644 --- a/ui/sdl2.c +++ b/ui/sdl2.c @@ -332,6 +332,10 @@ static void handle_keydown(SDL_Event *ev) int gui_key_modifier_pressed = get_mod_state(); int gui_keysym = 0; + if (!scon) { + return; + } + if (!scon->ignore_hotkeys && gui_key_modifier_pressed && !ev->key.repeat) { switch (ev->key.keysym.scancode) { case SDL_SCANCODE_2: @@ -412,6 +416,10 @@ static void handle_keyup(SDL_Event *ev) { struct sdl2_console *scon = get_scon_from_window(ev->key.windowID); + if (!scon) { + return; + } + scon->ignore_hotkeys = false; sdl2_process_key(scon, &ev->key); } @@ -421,6 +429,10 @@ static void handle_textinput(SDL_Event *ev) struct sdl2_console *scon = get_scon_from_window(ev->text.windowID); QemuConsole *con = scon ? scon->dcl.con : NULL; + if (!con) { + return; + } + if (qemu_console_is_graphic(con)) { return; } -- cgit v1.1