OSDN Git Service

DO NOT MERGE: Use a weak pointer to deliver updates to AVRCP devices.
authorAjay Panicker <apanicke@google.com>
Fri, 14 Dec 2018 22:55:02 +0000 (14:55 -0800)
committerAjay Panicker <apanicke@google.com>
Fri, 8 Mar 2019 23:56:27 +0000 (23:56 +0000)
commitf083d1e076ea97e6feaa363f03dab3656bd03ee0
treeba4f5f306328a81c1de7e0ca689a895a95500842
parent2a1ee659eaa5eb6a03d963f2b8e3ded860a1cc52
DO NOT MERGE: Use a weak pointer to deliver updates to AVRCP devices.

If a device disconnects right before a update message gets queued, the
device becomes null and there is a crash when the callback for the
update executes on the disconnected device. This patch switches the
device reference from being Unretained to using a weak pointer so that
the callback just doesn't execute if the device is disconnected.

Bug: 120431125
Bug: 120445479
Test: Use the same test as b/120477414 as that bug causes a disconnect
at the same time as a media update.

Change-Id: I1dcc08e5c9866106e7ec0dad52505e34b42da600
btif/avrcp/avrcp_service.cc
profile/avrcp/device.cc
profile/avrcp/device.h