[gnome-settings-daemon] mouse: Don't crash if mouse has no FeedbackStates
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] mouse: Don't crash if mouse has no FeedbackStates
- Date: Fri, 6 May 2011 17:42:02 +0000 (UTC)
commit f06775d9b415dd6bd7ae2efcc7e4164e0b355c4a
Author: Bastien Nocera <hadess hadess net>
Date: Fri May 6 18:38:55 2011 +0100
mouse: Don't crash if mouse has no FeedbackStates
When XGetFeedbackControl fails, it returns NULL, and num_feedbacks
might not have been set to a decent value. We should check the return
value instead of thinking that num_feedbacks will always have a
valid value.
https://bugzilla.gnome.org/show_bug.cgi?id=649539
plugins/mouse/gsd-mouse-manager.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/plugins/mouse/gsd-mouse-manager.c b/plugins/mouse/gsd-mouse-manager.c
index 7fe8f37..09c0eb5 100644
--- a/plugins/mouse/gsd-mouse-manager.c
+++ b/plugins/mouse/gsd-mouse-manager.c
@@ -447,6 +447,8 @@ set_motion (GsdMouseManager *manager,
/* Get the list of feedbacks for the device */
states = XGetFeedbackControl (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice, &num_feedbacks);
+ if (states == NULL)
+ num_feedbacks = 0;
state = (XFeedbackState *) states;
for (i = 0; i < num_feedbacks; i++) {
if (state->class == PtrFeedbackClass) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]