Skip to content

Commit

Permalink
Close bitmapReference and datasource safely
Browse files Browse the repository at this point in the history
  • Loading branch information
skydoves committed Mar 10, 2023
1 parent ac47cbc commit 386c8f4
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,15 @@ internal class FlowBaseBitmapDataSubscriber : BaseBitmapReferenceDataSubscriber(
data = bitmapReference?.cloneOrNull(),
dataSource = imageOrigin.toDataSource()
)
CloseableReference.closeSafely(bitmapReference)
}

override fun onFailureImpl(dataSource: DataSource<CloseableReference<CloseableImage>>) {
this.internalStateFlow.value = ImageLoadState.Failure(
data = dataSource,
data = dataSource.result?.cloneOrNull(),
reason = dataSource.failureCause
)
dataSource.close()
}

override fun onProgressUpdate(dataSource: DataSource<CloseableReference<CloseableImage>>) {
Expand Down

0 comments on commit 386c8f4

Please sign in to comment.