Use borrow() to fix GC hazard in stream_chunk (#33976)

* Use borrow() to fix GC hazard in stream_chunk

Signed-off-by: L Ashwin B <lashwinib@gmail.com>

* added the corrections

Signed-off-by: L Ashwin B <lashwinib@gmail.com>

---------

Signed-off-by: L Ashwin B <lashwinib@gmail.com>
This commit is contained in:
chickenleaf 2024-10-23 17:21:15 +05:30 committed by GitHub
parent 12e6ec25aa
commit 324f42abd7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -446,7 +446,7 @@ impl Response {
pub fn stream_chunk(&self, chunk: Vec<u8>, can_gc: CanGc) {
// Note, are these two actually mutually exclusive?
if let Some(stream_consumer) = self.stream_consumer.borrow_mut().as_ref() {
if let Some(stream_consumer) = self.stream_consumer.borrow().as_ref() {
stream_consumer.consume_chunk(chunk.as_slice());
} else if let Some(body) = self.body_stream.get() {
body.enqueue_native(chunk, can_gc);