Chromium Code Reviews| Index: views/touchui/touch_factory.cc |
| diff --git a/views/touchui/touch_factory.cc b/views/touchui/touch_factory.cc |
| index 66cdf6b3b135d95c7eafbffdecd25832ecd8924b..b360ce51135a35282565bee5568cd368a6d6e04b 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,9 @@ TouchFactory::TouchFactory() |
| touch_device_list_.push_back(devlist[i].id); |
| } |
| } |
| - XFreeDeviceList(devlist); |
| + if (devlist) { |
| + XFreeDeviceList(devlist); |
| + } |
|
sadrul
2011/03/25 15:49:41
-braces
Rick Byers
2011/03/25 17:25:49
Done.
|
| } |
| TouchFactory::~TouchFactory() { |