Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(61)

Unified Diff: views/touchui/touch_factory.cc

Issue 6736029: Tweak XInput2 event subscription (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Remove unnecessary braces Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/message_pump_glib_x.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/touchui/touch_factory.cc
diff --git a/views/touchui/touch_factory.cc b/views/touchui/touch_factory.cc
index 66cdf6b3b135d95c7eafbffdecd25832ecd8924b..aeb1de2260d35f2f03283711161b1a2e64d6885c 100644
--- a/views/touchui/touch_factory.cc
+++ b/views/touchui/touch_factory.cc
@@ -43,6 +43,8 @@ TouchFactory::TouchFactory()
// NOTE: The new API for retrieving the list of devices (XIQueryDevice) does
// not provide enough information to detect a touch device. As a result, the
// old version of query function (XListInputDevices) is used instead.
+ // If XInput2 is not supported, this will return null (with count of -1) so
+ // we assume there cannot be any touch devices.
int count = 0;
XDeviceInfo* devlist = XListInputDevices(display, &count);
for (int i = 0; i < count; i++) {
@@ -52,7 +54,8 @@ TouchFactory::TouchFactory()
touch_device_list_.push_back(devlist[i].id);
}
}
- XFreeDeviceList(devlist);
+ if (devlist)
+ XFreeDeviceList(devlist);
}
TouchFactory::~TouchFactory() {
« no previous file with comments | « base/message_pump_glib_x.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698