summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorreillyg <reillyg@chromium.org>2014-12-04 15:12:31 -0800
committerCommit bot <commit-bot@chromium.org>2014-12-04 23:14:05 +0000
commitb88da3cc8799bcdff19365c0f2f67003fc1c0ddb (patch)
tree30af9a8ef505ae0d828dde323161715a1bac7921
parentf37ffd7f2a6c72bbdeed3dffaa4a9ca7e844d7b2 (diff)
downloadchromium_src-b88da3cc8799bcdff19365c0f2f67003fc1c0ddb.zip
chromium_src-b88da3cc8799bcdff19365c0f2f67003fc1c0ddb.tar.gz
chromium_src-b88da3cc8799bcdff19365c0f2f67003fc1c0ddb.tar.bz2
Fix HID device remove events on Linux.
HID device entries were not being removed because a raw pointer to the device ID (just the sysfs path of the device) was being bound into a base::Callback without being wrapped in an std::string. The raw pointer would be invalid before the task was executed. The fix is to explicitly convert to a std::string before the call to base::Bind. This is an unexpected behavior of base::Bind as normally raw pointers must be wrapped in base::Owned or base::Unretained. BUG= Review URL: https://codereview.chromium.org/777313002 Cr-Commit-Position: refs/heads/master@{#306925}
-rw-r--r--device/hid/hid_service_linux.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/device/hid/hid_service_linux.cc b/device/hid/hid_service_linux.cc
index 1319331..8360840 100644
--- a/device/hid/hid_service_linux.cc
+++ b/device/hid/hid_service_linux.cc
@@ -162,8 +162,8 @@ class HidServiceLinux::Helper : public DeviceMonitorLinux::Observer,
const char* device_path = udev_device_get_syspath(device);
if (device_path) {
task_runner_->PostTask(
- FROM_HERE,
- base::Bind(&HidServiceLinux::RemoveDevice, service_, device_path));
+ FROM_HERE, base::Bind(&HidServiceLinux::RemoveDevice, service_,
+ std::string(device_path)));
}
}