Chromium Code Reviews| Index: chrome/utility/chrome_content_utility_client.cc |
| diff --git a/chrome/utility/chrome_content_utility_client.cc b/chrome/utility/chrome_content_utility_client.cc |
| index 8bd49b41ab339f9c7cc56db93da6ead3a4bcff82..962090ed31fada1360e247794d1534eff5776d4a 100644 |
| --- a/chrome/utility/chrome_content_utility_client.cc |
| +++ b/chrome/utility/chrome_content_utility_client.cc |
| @@ -178,6 +178,15 @@ bool ChromeContentUtilityClient::OnMessageReceived( |
| for (Handlers::iterator it = handlers_.begin(); |
|
jochen (gone - plz use gerrit)
2016/05/06 10:32:30
why not:
if (handled) return true;
for (auto& ha
Anand Mistry (off Chromium)
2016/05/09 02:32:14
I was just trying to minimise the change. I've cha
|
| !handled && it != handlers_.end(); ++it) { |
| handled = (*it)->OnMessageReceived(message); |
| + |
| + // Warning, this is a hack! At least one of the utility process handlers |
| + // adds a new handler to |handlers_| when it handles a message. This causes |
| + // |it| to become invalid and hence the increment, which happens before |
| + // checking the loop condition, is an invalid operation. For now, just |
| + // early-out of this loop and avoid incrementing the iterator. Eventually, |
| + // this will be fixed by moving everything to Mojo. |
| + if (handled) |
| + return true; |
| } |
| return handled; |