From 951e1e0bc70eca2e26df99a2e444640bc610e5b5 Mon Sep 17 00:00:00 2001 From: Jonathon Jongsma Date: Mon, 26 Jan 2015 15:06:55 -0600 Subject: Fix crash when checking mouse mode Since the mouse mode is now stored in the inputs channel, we were crashing when somebody was calling this API before the inputs channel was created. --- server/inputs-channel.c | 1 + server/reds.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/server/inputs-channel.c b/server/inputs-channel.c index e346829a..d0853a98 100644 --- a/server/inputs-channel.c +++ b/server/inputs-channel.c @@ -708,6 +708,7 @@ int inputs_channel_set_tablet(InputsChannel *inputs, SpiceTabletInstance *tablet int inputs_channel_has_tablet(InputsChannel *inputs) { + spice_return_val_if_fail(inputs != NULL, FALSE); return !!inputs->tablet; } diff --git a/server/reds.c b/server/reds.c index aa8bbc46..84b6da52 100644 --- a/server/reds.c +++ b/server/reds.c @@ -558,7 +558,9 @@ static void reds_update_mouse_mode(RedsState *reds) int allowed = 0; int qxl_count = red_dispatcher_qxl_count(); - if ((agent_mouse && vdagent) || (inputs_channel_has_tablet(reds->inputs_channel) && qxl_count == 1)) { + if ((agent_mouse && vdagent) || + ((reds->inputs_channel && inputs_channel_has_tablet(reds->inputs_channel)) && + qxl_count == 1)) { allowed = reds->dispatcher_allows_client_mouse; } if (allowed == reds->is_client_mouse_allowed) { -- cgit