Skip to content

Commit

Permalink
Fix sub/unsub/sub bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
Treora committed Jun 5, 2013
1 parent 4f68c5a commit 22cd318
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion rxjava-core/src/main/java/rx/operators/OperationGroupBy.java
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ public void unsubscribe() {
if (numGroupSubscriptions.get() == 0) {
// if we have no group subscriptions we will unsubscribe
actualParentSubscription.unsubscribe();
} else {
// otherwise we mark to not send any more groups (waiting on existing groups to finish)
unsubscribeRequested.set(true);
}
Expand All @@ -160,7 +161,7 @@ private void subscribeKey(K key) {
*/
private void unsubscribeKey(K key) {
int c = numGroupSubscriptions.decrementAndGet();
if (c == 0) {
if (c == 0 && unsubscribeRequested.get()) {
actualParentSubscription.unsubscribe();
}
}
Expand Down

0 comments on commit 22cd318

Please sign in to comment.