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

Unified Diff: device/bluetooth/bluetooth_discovery_session.cc

Issue 188473002: device/bluetooth: Remove BluetoothAdapter::Start|StopDiscovering. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed potential invalid access in BluetoothDiscoverySession destructor. Created 6 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
Index: device/bluetooth/bluetooth_discovery_session.cc
diff --git a/device/bluetooth/bluetooth_discovery_session.cc b/device/bluetooth/bluetooth_discovery_session.cc
index 076123e3ad8f97c08461aead83370581cf8bed54..355bdf63da5132fe95025aaec39d28c16c9ce432 100644
--- a/device/bluetooth/bluetooth_discovery_session.cc
+++ b/device/bluetooth/bluetooth_discovery_session.cc
@@ -23,9 +23,11 @@ BluetoothDiscoverySession::BluetoothDiscoverySession()
}
BluetoothDiscoverySession::~BluetoothDiscoverySession() {
- if (!active_)
+ // |adapter_| may be NULL if this instance was initialized as a mock.
+ if (!adapter_.get()) {
+ DCHECK(!active_);
return;
- DCHECK(adapter_.get());
+ }
Stop(base::Bind(&base::DoNothing), base::Bind(&base::DoNothing));
adapter_->DiscoverySessionDestroyed(this);
}

Powered by Google App Engine
This is Rietveld 408576698