summaryrefslogtreecommitdiff
path: root/keystore/java/android/security/KeyStore.java
diff options
context:
space:
mode:
authorMihai Popa <popam@google.com>2018-06-06 14:30:54 +0100
committerMihai Popa <popam@google.com>2018-06-08 10:15:04 +0000
commitc390e51b45f660d78d9b14f6c3f0db34142b90d2 (patch)
tree76c6e12c8ee46a41f1a8fa0bb9354a1353157f3b /keystore/java/android/security/KeyStore.java
parentf61f75ecf6a39554d1ec6e28207c408bdc1ac18c (diff)
[Magnifier-44] Fix memory leak caused by callback
Before this CL, the magnifier could have caused a memory leak when: - in Editor we give the magnifier a callback that updates the visibility of the handles after the magnifier is drawn. This holds a reference to the HandleView, which in turn has a reference to the containing Activity - the callback is set on the InternalPopupWindow, in order to be run after the next #doDraw call - #doDraw is post'd as a runnable to the UI thread - the magnifier is dismissed and the activity is destroyed - when the garbage collection happens, the InternalPopupWindow cannot be collected, because either: -- there is still a reference to the job expected to run #doDraw -- there is still a pixel copy that has to finish. We keep a reference to the InternalPopupWindow in use when the pixel copy was requested in order to compare it with the current one, and dismiss the pixel copy result if the instance has changed - both options above mean that we will still have a reference to the callback that sets the visibility of the handles, so a reference to the containing Activity. The Activity is, therefore, leaked. This CL cleares the handle visibility callback when the magnifier is dismissed, such that the unnecessary reference to the Activity will not be held. Bug: 80279783 Test: verified with leakcanary that the memory leak no longer exists Change-Id: I65c77eb12d2778c76fe631b55e6a7164fbf487f1
Diffstat (limited to 'keystore/java/android/security/KeyStore.java')
0 files changed, 0 insertions, 0 deletions