summaryrefslogtreecommitdiffstats
path: root/chromeos/dbus/bluetooth_adapter_client.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromeos/dbus/bluetooth_adapter_client.cc')
-rw-r--r--chromeos/dbus/bluetooth_adapter_client.cc14
1 files changed, 8 insertions, 6 deletions
diff --git a/chromeos/dbus/bluetooth_adapter_client.cc b/chromeos/dbus/bluetooth_adapter_client.cc
index bfbe2a1..f6138f7 100644
--- a/chromeos/dbus/bluetooth_adapter_client.cc
+++ b/chromeos/dbus/bluetooth_adapter_client.cc
@@ -58,8 +58,8 @@ class BluetoothAdapterClientImpl: public BluetoothAdapterClient,
public:
explicit BluetoothAdapterClientImpl(dbus::Bus* bus,
BluetoothManagerClient* manager_client)
- : weak_ptr_factory_(this),
- bus_(bus) {
+ : bus_(bus),
+ weak_ptr_factory_(this) {
DVLOG(1) << "Creating BluetoothAdapterClientImpl";
DCHECK(manager_client);
@@ -715,15 +715,17 @@ class BluetoothAdapterClientImpl: public BluetoothAdapterClient,
callback.Run(object_path, response);
}
- // Weak pointer factory for generating 'this' pointers that might live longer
- // than we do.
- base::WeakPtrFactory<BluetoothAdapterClientImpl> weak_ptr_factory_;
-
dbus::Bus* bus_;
// List of observers interested in event notifications from us.
ObserverList<BluetoothAdapterClient::Observer> observers_;
+ // Weak pointer factory for generating 'this' pointers that might live longer
+ // than we do.
+ // Note: This should remain the last member so it'll be destroyed and
+ // invalidate its weak pointers before any other members are destroyed.
+ base::WeakPtrFactory<BluetoothAdapterClientImpl> weak_ptr_factory_;
+
DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterClientImpl);
};