diff --git a/src/objective-c/RxLibrary/GRXBufferedPipe.m b/src/objective-c/RxLibrary/GRXBufferedPipe.m index e1295cef8ae674cee40312c87006db6bb19c51d6..3ef470f89ff1395d5aea5fb5e11caa25d624bf12 100644 --- a/src/objective-c/RxLibrary/GRXBufferedPipe.m +++ b/src/objective-c/RxLibrary/GRXBufferedPipe.m @@ -84,6 +84,10 @@ } else { // Even if we're paused and with enqueued values, we can't excert back-pressure to our writer. // So just buffer the new value. + // We need a copy, so that it doesn't mutate before it's written at the other end of the pipe. + if ([value respondsToSelector:@selector(copy)]) { + value = [value copy]; + } [_queue addObject:value]; } }