mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1042561 - Iterate a copy of mSearches in StartSearch() so that an observer can't modify the array we're iterating r=mak
This commit is contained in:
parent
7e9120e3bc
commit
771d166bc0
@ -1110,8 +1110,13 @@ nsAutoCompleteController::StartSearch(uint16_t aSearchType)
|
||||
NS_ENSURE_STATE(mInput);
|
||||
nsCOMPtr<nsIAutoCompleteInput> input = mInput;
|
||||
|
||||
for (uint32_t i = 0; i < mSearches.Length(); ++i) {
|
||||
nsCOMPtr<nsIAutoCompleteSearch> search = mSearches[i];
|
||||
// Iterate a copy of |mSearches| so that we don't run into trouble if the
|
||||
// array is mutated while we're still in the loop. An nsIAutoCompleteSearch
|
||||
// implementation could synchronously start a new search when StartSearch()
|
||||
// is called and that would lead to assertions down the way.
|
||||
nsCOMArray<nsIAutoCompleteSearch> searchesCopy(mSearches);
|
||||
for (uint32_t i = 0; i < searchesCopy.Length(); ++i) {
|
||||
nsCOMPtr<nsIAutoCompleteSearch> search = searchesCopy[i];
|
||||
|
||||
// Filter on search type. Not all the searches implement this interface,
|
||||
// in such a case just consider them delayed.
|
||||
|
Loading…
Reference in New Issue
Block a user