new_stream->chan = channel;
new_stream->wait_fd = fd;
+ /*
+ * We've just assigned the channel to the stream so increment the
+ * refcount right now.
+ */
+ uatomic_inc(&new_stream->chan->refcount);
+
/*
* The buffer flush is done on the session daemon side for the kernel
* so no need for the stream "hangup_flush_done" variable to be