diff options
author | Jonathon Jongsma <jjongsma@redhat.com> | 2015-01-26 15:06:55 -0600 |
---|---|---|
committer | Fabiano FidĂȘncio <fidencio@redhat.com> | 2015-02-23 23:00:44 +0100 |
commit | 951e1e0bc70eca2e26df99a2e444640bc610e5b5 (patch) | |
tree | fe2a362713a85d78bfaaecbf805fb09797d21e42 | |
parent | 4e518e91a469413fc541507f8108fff8ccd0a3ad (diff) | |
download | spice-951e1e0bc70eca2e26df99a2e444640bc610e5b5.tar.gz spice-951e1e0bc70eca2e26df99a2e444640bc610e5b5.tar.xz spice-951e1e0bc70eca2e26df99a2e444640bc610e5b5.zip |
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.
-rw-r--r-- | server/inputs-channel.c | 1 | ||||
-rw-r--r-- | server/reds.c | 4 |
2 files changed, 4 insertions, 1 deletions
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) { |