Skip to content

Commit

Permalink
Merge branch 'tim/keepalive_stop' into 'master'
Browse files Browse the repository at this point in the history
fix: Keep Tanker object alive in stop() until fully stopped

See merge request TankerHQ/sdk-android!207
  • Loading branch information
tux3 committed May 3, 2021
2 parents 205eec6 + 4c9df2e commit 0bab9e3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tanker-bindings/src/main/kotlin/io/tanker/api/Tanker.kt
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,9 @@ class Tanker(tankerOptions: TankerOptions) {
*/
fun stop(): TankerFuture<Unit> {
val futurePtr = lib.tanker_stop(tanker)
return TankerFuture(futurePtr, Unit::class.java)
return TankerFuture<Unit>(futurePtr, Unit::class.java).andThen(TankerCallbackWithKeepAlive(keepAlive = this) {
// Keep the GC from calling tanker_destroy() through the finalizer until stop() is finished
})
}

/**
Expand Down

0 comments on commit 0bab9e3

Please sign in to comment.