Changeset 221292 in webkit
- Timestamp:
- Aug 29, 2017 2:32:34 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 8 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r221287 r221292 1 2017-08-19 Sergio Villar Senin <svillar@igalia.com> 2 3 [SVG] Leak in SVGAnimatedListPropertyTearOff 4 https://bugs.webkit.org/show_bug.cgi?id=172545 5 6 Reviewed by Darin Adler. 7 8 The list of new added tests includes the one for the original bug, a new test for the 9 regression and a couple of tests imported from Blink which verify that 10 SVGAnimatedListPropertyTearOff does not crash after the context element goes out of scope. 11 12 * svg/animations/animation-leak-list-property-instances-expected.txt: Added. 13 * svg/animations/animation-leak-list-property-instances.html: Added. 14 * svg/dom/SVGAnimatedListPropertyTearOff-crash-2-expected.txt: Added. Imported from Blink. 15 * svg/dom/SVGAnimatedListPropertyTearOff-crash-2.html: Added. Imported from Blink. 16 * svg/dom/SVGAnimatedListPropertyTearOff-crash-expected.txt: Added. Imported from Blink. 17 * svg/dom/SVGAnimatedListPropertyTearOff-crash.html: Added. Imported from Blink. 18 * svg/dom/SVGAnimatedListPropertyTearOff-leak-expected.txt: Added. 19 * svg/dom/SVGAnimatedListPropertyTearOff-leak.html: Added. 20 1 21 2017-08-28 Per Arne Vollan <pvollan@apple.com> 2 22 -
trunk/Source/WebCore/ChangeLog
r221291 r221292 1 2017-08-19 Sergio Villar Senin <svillar@igalia.com> 2 3 [SVG] Leak in SVGAnimatedListPropertyTearOff 4 https://bugs.webkit.org/show_bug.cgi?id=172545 5 6 Reviewed by Darin Adler. 7 8 SVGAnimatedListPropertyTearOff maintains a vector m_wrappers with references to 9 SVGPropertyTraits<PropertyType>::ListItemTearOff. Apart from that SVGPropertyTearOff has a 10 reference to SVGAnimatedProperty. 11 12 When SVGListProperty::getItemValuesAndWrappers() is called, it creates a 13 SVGPropertyTraits<PropertyType>::ListItemTearOff pointing to the same SVGAnimatedProperty (a 14 SVGAnimatedListPropertyTearOff) which stores the m_wrappers vector where the ListItemTearOff 15 is going to be added to. This effectively creates a reference cycle between the 16 SVGAnimatedListPropertyTearOff and all the ListItemTearOff it stores in m_wrappers. 17 18 In order to effectively break the cycle without freeing too many wrappers we should take two 19 measures: 20 1) Break the reference cycle by storing raw pointers in the m_wrappers Vector 21 2) Remove the ListItemTearOff which is being deleted (it notifies the animated property by 22 calling propertyWillBeDeleted) from the m_wrappers Vector. 23 24 This is a re-land of r219334 which caused early releases of custom data attribute objects 25 added to SVG elements (wkb.ug/175023). 26 27 Tests: svg/animations/animation-leak-list-property-instances.html 28 svg/dom/SVGAnimatedListPropertyTearOff-crash-2.html 29 svg/dom/SVGAnimatedListPropertyTearOff-crash.html 30 svg/dom/SVGAnimatedListPropertyTearOff-leak.html 31 32 * svg/properties/SVGAnimatedListPropertyTearOff.h: 33 * svg/properties/SVGListProperty.h: 34 (WebCore::SVGListProperty::getItemValuesAndWrappers): 35 * svg/properties/SVGListPropertyTearOff.h: 36 (WebCore::SVGListPropertyTearOff::removeItemFromList): 37 1 38 2017-08-29 Andy Estes <aestes@apple.com> 2 39 -
trunk/Source/WebCore/svg/properties/SVGAnimatedListPropertyTearOff.h
r220484 r221292 35 35 using ListItemType = typename SVGPropertyTraits<PropertyType>::ListItemType; 36 36 using ListItemTearOff = typename SVGPropertyTraits<PropertyType>::ListItemTearOff; 37 using ListWrapperCache = Vector< RefPtr<ListItemTearOff>>;37 using ListWrapperCache = Vector<ListItemTearOff*>; 38 38 using ListProperty = SVGListProperty<PropertyType>; 39 39 using ListPropertyTearOff = typename SVGPropertyTraits<PropertyType>::ListPropertyTearOff; … … 74 74 else if (&property == m_animVal) 75 75 m_animVal = nullptr; 76 else { 77 size_t i = m_wrappers.find(&property); 78 if (i != notFound) 79 m_wrappers[i] = nullptr; 80 } 76 81 } 77 82 -
trunk/Source/WebCore/svg/properties/SVGListProperty.h
r219856 r221292 207 207 // that it has been modified (and thus can call svgAttributeChanged(associatedAttributeName)). 208 208 wrapper = ListItemTearOff::create(animatedList, UndefinedRole, m_values->at(index)); 209 m_wrappers->at(index) = wrapper ;209 m_wrappers->at(index) = wrapper.get(); 210 210 } 211 211 -
trunk/Source/WebCore/svg/properties/SVGListPropertyTearOff.h
r208863 r221292 67 67 ASSERT_WITH_SECURITY_IMPLICATION(itemIndex < m_wrappers->size()); 68 68 69 RefPtr<ListItemTearOff> &item = m_wrappers->at(itemIndex);69 RefPtr<ListItemTearOff> item = m_wrappers->at(itemIndex); 70 70 item->detachWrapper(); 71 71 m_wrappers->remove(itemIndex); … … 142 142 ASSERT(size == m_values->size()); 143 143 for (unsigned i = 0; i < size; ++i) { 144 ListItemTearOff* item = m_wrappers->at(i) .get();144 ListItemTearOff* item = m_wrappers->at(i); 145 145 if (!item) 146 146 continue;
Note: See TracChangeset
for help on using the changeset viewer.