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:
Kyeongkab.Nam
2019-04-22 18:14:45 +09:00
parent cacfab6728
commit d40b5cecfe

View File

@@ -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;