diff options
author | Muxi Yan <mxyan@google.com> | 2019-01-09 15:22:05 -0800 |
---|---|---|
committer | Muxi Yan <mxyan@google.com> | 2019-01-09 15:22:05 -0800 |
commit | 121e04bc1e44bb684d464be6788f1c0a065b1116 (patch) | |
tree | 4c53ba9391bfe53aaaf80a796e942e0910150b08 /src/objective-c/RxLibrary | |
parent | d4fa274bf2994276341e47920aa46e7a009b4d10 (diff) |
address comments 2
Diffstat (limited to 'src/objective-c/RxLibrary')
-rw-r--r-- | src/objective-c/RxLibrary/GRXForwardingWriter.m | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/objective-c/RxLibrary/GRXForwardingWriter.m b/src/objective-c/RxLibrary/GRXForwardingWriter.m index f5ed603698..27ac0acdff 100644 --- a/src/objective-c/RxLibrary/GRXForwardingWriter.m +++ b/src/objective-c/RxLibrary/GRXForwardingWriter.m @@ -72,7 +72,11 @@ #pragma mark GRXWriter implementation - (GRXWriterState)state { - return _writer ? _writer.state : GRXWriterStateFinished; + GRXWriter *copiedWriter; + @synchronized(self) { + copiedWriter = _writer; + } + return copiedWriter ? copiedWriter.state : GRXWriterStateFinished; } - (void)setState:(GRXWriterState)state { @@ -106,6 +110,7 @@ @synchronized(self) { [self finishOutputWithError:errorOrNil]; copiedWriter = _writer; + _writer = nil; } copiedWriter.state = GRXWriterStateFinished; } |