Fix the reference leak on RemoteCallbackList
In case that register is invoked consecutively with same callback, reference leack could be happened since unlinkToDeath for all callbacks is not being called. Test: call register multiple times with same callback and unregister callback same times. confirm the global reference table information. Change-Id: I7dbf108ea87b3ee7ce1e1a0ff75e05e8c4478f67
This commit is contained in:
@@ -123,6 +123,7 @@ public class RemoteCallbackList<E extends IInterface> {
|
||||
IBinder binder = callback.asBinder();
|
||||
try {
|
||||
Callback cb = new Callback(callback, cookie);
|
||||
unregister(callback);
|
||||
binder.linkToDeath(cb, 0);
|
||||
mCallbacks.put(binder, cb);
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user