From 0aec2ee1c0b56461427bf5345a2bff48d0b478ea Mon Sep 17 00:00:00 2001 From: ziyue <1213642868@qq.com> Date: Wed, 15 Sep 2021 20:41:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DWebRtcTransport=E5=AF=B9?= =?UTF-8?q?=E8=B1=A1=E4=BD=BF=E7=94=A8=E6=97=B6=E9=87=8A=E6=94=BE=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E5=B4=A9=E6=BA=83=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webrtc/WebRtcSession.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/webrtc/WebRtcSession.cpp b/webrtc/WebRtcSession.cpp index 6500e00a..943a5b72 100644 --- a/webrtc/WebRtcSession.cpp +++ b/webrtc/WebRtcSession.cpp @@ -67,7 +67,9 @@ void WebRtcSession::onRecv_l(const Buffer::Ptr &buffer) { } _ticker.resetTime(); CHECK(_transport); - _transport->inputSockData(buffer->data(), buffer->size(), &_peer_addr); + //先增加引用技术,防止使用transport时,触发onError事件导致对象释放 + auto transport = _transport; + transport->inputSockData(buffer->data(), buffer->size(), &_peer_addr); } void WebRtcSession::onError(const SockException &err) {