deadlyjack / Acode

Acode - powerful text/code editor for android
https://acode.app
MIT License
2.9k stars 393 forks source link

Refactor Iap.java: Use WeakReference for Context and Activity to prevent memory leaks #1040

Closed ThDev-only closed 1 month ago

ThDev-only commented 1 month ago

This PR refactors Iap.java to prevent potential memory leaks by using WeakReference for Context and Activity. This ensures that these references can be garbage collected when necessary, improving memory management.

Changes:

Motivation:

Avoid memory leaks in cases where the lifecycle of Context or Activity may extend beyond expected, such as during async callbacks or long-running processes.