Skip to content

Commit

Permalink
Fix dangling ptr in ReadResponseCallbackWrapper (fixes #3760)
Browse files Browse the repository at this point in the history
  • Loading branch information
JCYang authored and magreenblatt committed Aug 5, 2024
1 parent be40859 commit bed7f42
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions libcef/browser/net_service/stream_reader_url_loader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,8 @@ class InputStreamReader : public base::RefCountedThreadSafe<InputStreamReader> {
InputStream::SkipCallback skip_callback);
static void RunReadCallbackOnJobThread(
int bytes_read,
InputStream::ReadCallback read_callback);
InputStream::ReadCallback read_callback,
scoped_refptr<net::IOBuffer> buffer);

std::unique_ptr<InputStream> stream_;

Expand Down Expand Up @@ -442,8 +443,9 @@ void InputStreamReader::RunReadCallback(int bytes_read) {

DCHECK(!pending_read_callback_.is_null());
job_thread_task_runner_->PostTask(
FROM_HERE, base::BindOnce(InputStreamReader::RunReadCallbackOnJobThread,
bytes_read, std::move(pending_read_callback_)));
FROM_HERE,
base::BindOnce(InputStreamReader::RunReadCallbackOnJobThread, bytes_read,
std::move(pending_read_callback_), buffer_));

// Reset callback state.
pending_callback_id_ = -1;
Expand All @@ -460,7 +462,8 @@ void InputStreamReader::RunSkipCallbackOnJobThread(
// static
void InputStreamReader::RunReadCallbackOnJobThread(
int bytes_read,
InputStream::ReadCallback read_callback) {
InputStream::ReadCallback read_callback,
scoped_refptr<net::IOBuffer> buffer) {
std::move(read_callback).Run(bytes_read);
}

Expand Down

0 comments on commit bed7f42

Please sign in to comment.