@@ -61,7 +61,8 @@ final class ExactSubscriber extends Subscriber<T> {
61
61
final Subscriber <? super Observable <T >> child ;
62
62
int count ;
63
63
BufferUntilSubscriber <T > window ;
64
- Subscription parentSubscription = this ;
64
+ volatile boolean noWindow = true ;
65
+ final Subscription parentSubscription = this ;
65
66
public ExactSubscriber (Subscriber <? super Observable <T >> child ) {
66
67
/**
67
68
* See https://github.com/ReactiveX/RxJava/issues/1546
@@ -77,7 +78,7 @@ public ExactSubscriber(Subscriber<? super Observable<T>> child) {
77
78
@ Override
78
79
public void call () {
79
80
// if no window we unsubscribe up otherwise wait until window ends
80
- if (window == null ) {
81
+ if (noWindow ) {
81
82
parentSubscription .unsubscribe ();
82
83
}
83
84
}
@@ -94,13 +95,15 @@ public void onStart() {
94
95
@ Override
95
96
public void onNext (T t ) {
96
97
if (window == null ) {
98
+ noWindow = false ;
97
99
window = BufferUntilSubscriber .create ();
98
100
child .onNext (window );
99
101
}
100
102
window .onNext (t );
101
103
if (++count % size == 0 ) {
102
104
window .onCompleted ();
103
105
window = null ;
106
+ noWindow = true ;
104
107
if (child .isUnsubscribed ()) {
105
108
parentSubscription .unsubscribe ();
106
109
return ;
@@ -130,7 +133,7 @@ final class InexactSubscriber extends Subscriber<T> {
130
133
final Subscriber <? super Observable <T >> child ;
131
134
int count ;
132
135
final List <CountedSubject <T >> chunks = new LinkedList <CountedSubject <T >>();
133
- Subscription parentSubscription = this ;
136
+ final Subscription parentSubscription = this ;
134
137
135
138
public InexactSubscriber (Subscriber <? super Observable <T >> child ) {
136
139
/**
0 commit comments