Summary: | _web_makePluginViewsPerformSelector:: mutates subviews array while iterating it | ||||||
---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | John Sullivan <sullivan> | ||||
Component: | Plug-ins | Assignee: | John Sullivan <sullivan> | ||||
Status: | RESOLVED FIXED | ||||||
Severity: | Normal | ||||||
Priority: | P2 | ||||||
Version: | 528+ (Nightly build) | ||||||
Hardware: | Mac | ||||||
OS: | All | ||||||
Attachments: |
|
Description
John Sullivan
2010-09-16 18:07:59 PDT
Created attachment 67870 [details]
Patch to avoid mutating array while enumerating it.
Comment on attachment 67870 [details]
Patch to avoid mutating array while enumerating it.
Historically, objectEnumerator creating a copy of the entire array! I’m surprised that it has changed so that it no longer does so.
Does this work properly when there are no subviews?
Instead of initWithArray: you could have used the copy method.
r=me
The fast enumeration introduced with ObjC-2.0 is used with objectEnumerator; that's when the prohibition against mutating a collection while enumerating it began. Other bugs like this have been fixed in WebKit, though maybe the others were all a long time ago (e.g. <http://trac.webkit.org/changeset/24827>). initWithArray: will return an empty array when passed nil, but the documentation is not clear about this. -copy will call -initWithArray:, but I guess it's a little bit better because it's unambiguous about what you'll get with a nil initial array, so I'll switch to using that. Thanks for reviewing! |