Skip to content

Commit 18e49bb

Browse files
Make unsubscribe idempotent.
1 parent 56d1ff6 commit 18e49bb

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/subscriptions/BooleanSubscription.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@ object BooleanSubscription {
1717
def apply(u: => Unit): BooleanSubscription = {
1818
new BooleanSubscription(new rx.subscriptions.BooleanSubscription {
1919
override def unsubscribe(): Unit = {
20-
u
21-
super.unsubscribe()
20+
if(!super.isUnsubscribed()) {
21+
u
22+
super.unsubscribe()
23+
}
2224
}
2325
})
2426
}

0 commit comments

Comments
 (0)