diff options
author | keybuk@chromium.org <keybuk@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-29 18:11:55 +0000 |
---|---|---|
committer | keybuk@chromium.org <keybuk@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-29 18:11:55 +0000 |
commit | f61e7201ea58f7a9395e9c122a8f40c2b8c6b0d5 (patch) | |
tree | 9ed5d34de4fb8b7ca4cb9e8132ffe8079d32b8cd /device | |
parent | 9fd8e700480e5315c8734f14e51b842e103492c1 (diff) | |
download | chromium_src-f61e7201ea58f7a9395e9c122a8f40c2b8c6b0d5.zip chromium_src-f61e7201ea58f7a9395e9c122a8f40c2b8c6b0d5.tar.gz chromium_src-f61e7201ea58f7a9395e9c122a8f40c2b8c6b0d5.tar.bz2 |
Bluetooth: unregister the agent on CancelPairing()
BluetoothOptionsHandler will call BluetoothDevice::CancelPairing()
when it's being torn down, after which pointers to it (e.g. the
pairing_delegate_ pointer) are invalid.
Thus unregister the agent at this point rather than waiting for a
response from the backend.
BUG=none
TEST=verify no crash when clicking Cancel or Reject during pairing
Review URL: https://chromiumcodereview.appspot.com/14273036
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@197085 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'device')
-rw-r--r-- | device/bluetooth/bluetooth_device_experimental_chromeos.cc | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/device/bluetooth/bluetooth_device_experimental_chromeos.cc b/device/bluetooth/bluetooth_device_experimental_chromeos.cc index 09c1ddf..d3ef05e 100644 --- a/device/bluetooth/bluetooth_device_experimental_chromeos.cc +++ b/device/bluetooth/bluetooth_device_experimental_chromeos.cc @@ -226,6 +226,10 @@ void BluetoothDeviceExperimentalChromeOS::CancelPairing() { base::Bind( &BluetoothDeviceExperimentalChromeOS::OnCancelPairingError, weak_ptr_factory_.GetWeakPtr())); + + // Since there's no calback to this method, it's possible that the pairing + // delegate is going to be freed before things complete. + UnregisterAgent(); } } @@ -556,7 +560,9 @@ void BluetoothDeviceExperimentalChromeOS::OnSetTrusted(bool success) { } void BluetoothDeviceExperimentalChromeOS::UnregisterAgent() { - DCHECK(agent_.get()); + if (!agent_.get()) + return; + DCHECK(pairing_delegate_); DCHECK(pincode_callback_.is_null()); |