summaryrefslogtreecommitdiffstats
path: root/chromeos/dbus/bluetooth_node_client.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromeos/dbus/bluetooth_node_client.cc')
-rw-r--r--chromeos/dbus/bluetooth_node_client.cc14
1 files changed, 8 insertions, 6 deletions
diff --git a/chromeos/dbus/bluetooth_node_client.cc b/chromeos/dbus/bluetooth_node_client.cc
index 46111d6..3b70ea1 100644
--- a/chromeos/dbus/bluetooth_node_client.cc
+++ b/chromeos/dbus/bluetooth_node_client.cc
@@ -40,8 +40,8 @@ class BluetoothNodeClientImpl: public BluetoothNodeClient,
public:
BluetoothNodeClientImpl(dbus::Bus* bus,
BluetoothDeviceClient* device_client)
- : weak_ptr_factory_(this),
- bus_(bus) {
+ : bus_(bus),
+ weak_ptr_factory_(this) {
DVLOG(1) << "Creating BluetoothNodeClientImpl";
DCHECK(device_client);
@@ -152,15 +152,17 @@ class BluetoothNodeClientImpl: public BluetoothNodeClient,
NodePropertyChanged(object_path, property_name));
}
- // Weak pointer factory for generating 'this' pointers that might live longer
- // than we do.
- base::WeakPtrFactory<BluetoothNodeClientImpl> weak_ptr_factory_;
-
dbus::Bus* bus_;
// List of observers interested in event notifications from us.
ObserverList<BluetoothNodeClient::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<BluetoothNodeClientImpl> weak_ptr_factory_;
+
DISALLOW_COPY_AND_ASSIGN(BluetoothNodeClientImpl);
};