Commit ca020c9c authored by jiayl's avatar jiayl Committed by Commit bot

Fix a null ptr deref crash in DesktopCaptureDevice

BUG=450382

Review URL: https://codereview.chromium.org/882153005

Cr-Commit-Position: refs/heads/master@{#314377}
parent 79812c1a
......@@ -451,7 +451,7 @@ DesktopCaptureDevice::~DesktopCaptureDevice() {
void DesktopCaptureDevice::AllocateAndStart(
const media::VideoCaptureParams& params,
scoped_ptr<Client> client) {
thread_.message_loop_proxy()->PostTask(
thread_.task_runner()->PostTask(
FROM_HERE,
base::Bind(&Core::AllocateAndStart, base::Unretained(core_.get()), params,
base::Passed(&client)));
......@@ -459,16 +459,20 @@ void DesktopCaptureDevice::AllocateAndStart(
void DesktopCaptureDevice::StopAndDeAllocate() {
if (core_) {
thread_.message_loop_proxy()->DeleteSoon(FROM_HERE, core_.release());
thread_.task_runner()->DeleteSoon(FROM_HERE, core_.release());
thread_.Stop();
}
}
void DesktopCaptureDevice::SetNotificationWindowId(
gfx::NativeViewId window_id) {
thread_.message_loop_proxy()->PostTask(
// This may be called after the capturer has been stopped.
if (!core_)
return;
thread_.task_runner()->PostTask(
FROM_HERE,
base::Bind(&Core::SetNotificationWindowId, base::Unretained(core_.get()),
base::Bind(&Core::SetNotificationWindowId,
base::Unretained(core_.get()),
window_id));
}
......@@ -485,7 +489,7 @@ DesktopCaptureDevice::DesktopCaptureDevice(
thread_.StartWithOptions(base::Thread::Options(thread_type, 0));
core_.reset(new Core(thread_.message_loop_proxy(), capturer.Pass(), type));
core_.reset(new Core(thread_.task_runner(), capturer.Pass(), type));
}
} // namespace content
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment