Index: media/capture/video/linux/v4l2_capture_delegate.cc |
diff --git a/media/capture/video/linux/v4l2_capture_delegate.cc b/media/capture/video/linux/v4l2_capture_delegate.cc |
index 2f16c203996b82851c6181e67ac4a3f07b96c8a6..3699bd324a880146609eae9bc2ebe3fec2ab2206 100644 |
--- a/media/capture/video/linux/v4l2_capture_delegate.cc |
+++ b/media/capture/video/linux/v4l2_capture_delegate.cc |
@@ -374,7 +374,8 @@ V4L2CaptureDelegate::V4L2CaptureDelegate( |
power_line_frequency_(power_line_frequency), |
is_capturing_(false), |
timeout_count_(0), |
- rotation_(0) {} |
+ rotation_(0), |
+ weak_factory_(this) {} |
void V4L2CaptureDelegate::AllocateAndStart( |
int width, |
@@ -506,7 +507,8 @@ void V4L2CaptureDelegate::AllocateAndStart( |
// Post task to start fetching frames from v4l2. |
v4l2_task_runner_->PostTask( |
- FROM_HERE, base::Bind(&V4L2CaptureDelegate::DoCapture, this)); |
+ FROM_HERE, |
+ base::Bind(&V4L2CaptureDelegate::DoCapture, weak_factory_.GetWeakPtr())); |
} |
void V4L2CaptureDelegate::StopAndDeAllocate() { |
@@ -820,7 +822,8 @@ void V4L2CaptureDelegate::DoCapture() { |
} |
v4l2_task_runner_->PostTask( |
- FROM_HERE, base::Bind(&V4L2CaptureDelegate::DoCapture, this)); |
+ FROM_HERE, |
+ base::Bind(&V4L2CaptureDelegate::DoCapture, weak_factory_.GetWeakPtr())); |
} |
void V4L2CaptureDelegate::SetErrorState( |