Skip to content

Commit

Permalink
service: fix release memory leaks
Browse files Browse the repository at this point in the history
  • Loading branch information
OxygenCobalt committed Oct 15, 2024
1 parent caa2e02 commit 9b4e9b3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions app/src/main/java/org/oxycblt/auxio/music/service/Indexer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@ private constructor(

fun release() {
contentObserver.release()
musicSettings.registerListener(this)
musicRepository.addIndexingListener(this)
musicRepository.addUpdateListener(this)
musicRepository.unregisterWorker(this)
musicRepository.removeIndexingListener(this)
musicRepository.removeUpdateListener(this)
musicSettings.unregisterListener(this)
}

override fun requestIndex(withCache: Boolean) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ private constructor(
*/
fun release() {
bitmapProvider.release()
playbackManager.removeListener(this)
playbackSettings.unregisterListener(this)
imageSettings.unregisterListener(this)
playbackManager.removeListener(this)
mediaSession.apply {
isActive = false
release()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@ private constructor(

fun release() {
waitJob.cancel()
playbackManager.removeListener(this)
systemReceiver.release()
widgetComponent.release()
context.unregisterReceiver(systemReceiver)
sessionHolder.release()
exoHolder.release()
playbackManager.removeListener(this)
}

override fun onSessionEnded() {
Expand Down

0 comments on commit 9b4e9b3

Please sign in to comment.