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)
committerJP Sugarbroad <jpsugar@google.com>
Tue, 19 Mar 2019 21:58:40 +0000 (14:58 -0700)
commitbd589528f6d6dcbbb606f2d7307f2893613b1392
treed3a0999dd2848d60742bf3ce111f9a3a6814ccb9
parente3f5d8818907321be5ca486688b861566b3214e8
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
(cherry picked from commit f083d1e076ea97e6feaa363f03dab3656bd03ee0)
btif/avrcp/avrcp_service.cc
profile/avrcp/device.cc
profile/avrcp/device.h