Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(600)

Unified Diff: content/browser/renderer_host/media/video_capture_manager.cc

Issue 2443473002: ImageCapture: fix using invalidated iterator after removing entry from |photo_request_queue_| (Closed)
Patch Set: alternative implementation suggested by reillyg@ Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/media/video_capture_manager.cc
diff --git a/content/browser/renderer_host/media/video_capture_manager.cc b/content/browser/renderer_host/media/video_capture_manager.cc
index 918630cf7b45a1c1c7bad04b0db34a395627925b..daaa731f957afec1cbabe60072bd62d5394ec99a 100644
--- a/content/browser/renderer_host/media/video_capture_manager.cc
+++ b/content/browser/renderer_host/media/video_capture_manager.cc
@@ -520,9 +520,9 @@ void VideoCaptureManager::HandleQueuedStartRequest() {
void VideoCaptureManager::OnDeviceStarted(
int serial_id,
std::unique_ptr<VideoCaptureDevice> device) {
+ DVLOG(3) << __func__;
DCHECK_CURRENTLY_ON(BrowserThread::IO);
DCHECK_EQ(serial_id, device_start_queue_.begin()->serial_id());
- DVLOG(3) << __func__;
if (device_start_queue_.front().abort_start()) {
// |device| can be null if creation failed in
// DoStartDeviceCaptureOnDeviceThread.
@@ -549,14 +549,14 @@ void VideoCaptureManager::OnDeviceStarted(
MaybePostDesktopCaptureWindowId(session_id);
}
- auto request = photo_request_queue_.begin();
- while(request != photo_request_queue_.end()) {
+ auto it = photo_request_queue_.begin();
+ while (it != photo_request_queue_.end()) {
+ auto request = it++;
DeviceEntry* maybe_entry = GetDeviceEntryBySessionId(request->first);
if (maybe_entry && maybe_entry->video_capture_device()) {
request->second.Run(maybe_entry->video_capture_device());
photo_request_queue_.erase(request);
}
- ++request;
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698