forked from premiere/premiere-libtorrent
web_peer_connection: make a copy of the request before calling incomi… (#1091)
web_peer_connection: make a copy of the request before calling incoming_piece
This commit is contained in:
parent
22043fd186
commit
0759b732c1
|
@ -979,8 +979,15 @@ void web_peer_connection::incoming_payload(char const* buf, int len)
|
|||
, front_request.piece, front_request.start, front_request.length);
|
||||
#endif
|
||||
|
||||
incoming_piece(front_request, &m_piece[0]);
|
||||
// Make a copy of the request and pop it off the queue before calling
|
||||
// incoming_piece because that may lead to a call to disconnect()
|
||||
// which will clear the request queue and invalidate any references
|
||||
// to the request
|
||||
peer_request const front_request_copy = front_request;
|
||||
m_requests.pop_front();
|
||||
|
||||
incoming_piece(front_request_copy, &m_piece[0]);
|
||||
|
||||
m_piece.clear();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue