[PATCH 11/16] Fix crash when checking mouse mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Jonathon Jongsma <jjongsma@xxxxxxxxxx>

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 9f33f0d..e28b4b0 100644
--- a/server/inputs-channel.c
+++ b/server/inputs-channel.c
@@ -704,6 +704,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 f35b602..3f2a132 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -613,7 +613,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) {
-- 
2.4.3

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]