Changeset 100046 in webkit
- Timestamp:
- Nov 11, 2011, 4:34:57 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 5 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/svg/custom/element-instance-held-by-js-crash-expected.txt (added)
-
LayoutTests/svg/custom/element-instance-held-by-js-crash.svg (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/svg/SVGElementInstance.cpp (modified) (1 diff)
-
Source/WebCore/svg/SVGElementInstance.h (modified) (1 diff)
-
Source/WebCore/svg/SVGUseElement.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r100045 r100046 1 2011-11-11 Stephen Chenney <schenney@chromium.org> 2 3 Null deref when no use element exists for SVG element instance 4 https://bugs.webkit.org/show_bug.cgi?id=59136 5 6 Second attempt, with a fix to handle JS garbage collection. 7 8 Reviewed by Nikolas Zimmermann. 9 10 * svg/custom/element-instance-held-by-js-crash-expected.txt: Added. 11 * svg/custom/element-instance-held-by-js-crash.svg: Added. 12 1 13 2011-11-11 Florin Malita <fmalita@google.com> 2 14 -
trunk/Source/WebCore/ChangeLog
r100045 r100046 1 2011-11-11 Stephen Chenney <schenney@chromium.org> 2 3 Null deref when no use element exists for SVG element instance 4 https://bugs.webkit.org/show_bug.cgi?id=59136 5 6 Second attempt, with a fix to handle JS garbage collection. 7 8 Reviewed by Nikolas Zimmermann. 9 10 Test: svg/custom/element-instance-held-by-js-crash.svg 11 12 * svg/SVGElementInstance.cpp: 13 (WebCore::SVGElementInstance::~SVGElementInstance): Added call to detach() to clear 14 anything not yet cleared. 15 (WebCore::SVGElementInstance::detach): New method to replace old clear methods. This one 16 clears all the pointers it can, and removes the instance from the corresponding elements 17 instance list. 18 * svg/SVGElementInstance.h: Removed clear methods and replaced with detach. 19 * svg/SVGUseElement.cpp: 20 (WebCore::SVGUseElement::detachInstance): Modified calls to clean up an SVGElementInstance. 21 1 22 2011-11-11 Florin Malita <fmalita@google.com> 2 23 -
trunk/Source/WebCore/svg/SVGElementInstance.cpp
r99861 r100046 62 62 SVGElementInstance::~SVGElementInstance() 63 63 { 64 // Call detach because we may be deleted directly if we are a child of a detached instance. 65 detach(); 66 64 67 #ifndef NDEBUG 65 68 instanceCounter.decrement(); 66 69 #endif 67 70 68 // Deregister as instance for passed element. 69 m_element->removeInstanceMapping(this); 70 71 clearChildren(); 71 m_element = 0; 72 72 } 73 73 74 void SVGElementInstance:: clearChildren()74 void SVGElementInstance::detach() 75 75 { 76 // Clear all pointers. When the node is detached from the shadow DOM it should be removed but, 77 // due to ref counting, it may not be. So clear everything to avoid dangling pointers. 78 79 // Deregister as instance for passed element, if we haven't already. 80 if (m_element->instancesForElement().contains(this)) 81 m_element->removeInstanceMapping(this); 82 // DO NOT clear ref to m_element because JavaScriptCore uses it for garbage collection 83 84 m_shadowTreeElement = 0; 85 86 m_directUseElement = 0; 87 m_correspondingUseElement = 0; 88 76 89 removeAllChildrenInContainer<SVGElementInstance, SVGElementInstance>(this); 77 90 } -
trunk/Source/WebCore/svg/SVGElementInstance.h
r99861 r100046 61 61 SVGUseElement* directUseElement() const { return m_directUseElement; } 62 62 SVGElement* shadowTreeElement() const { return m_shadowTreeElement.get(); } 63 void clearChildren(); 64 void clearUseElements() 65 { 66 m_directUseElement = 0; 67 m_correspondingUseElement = 0; 68 } 63 64 void detach(); 69 65 70 66 SVGElementInstance* parentNode() const { return parent(); } -
trunk/Source/WebCore/svg/SVGUseElement.cpp
r99861 r100046 625 625 if (!m_targetElementInstance) 626 626 return; 627 m_targetElementInstance->clearUseElements(); 628 m_targetElementInstance->clearChildren(); 627 m_targetElementInstance->detach(); 629 628 m_targetElementInstance = 0; 630 629 }
Note:
See TracChangeset
for help on using the changeset viewer.