Changeset 39149 in webkit
- Timestamp:
- Dec 9, 2008, 3:36:39 PM (16 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r39146 r39149 1 2008-12-09 Sam Weinig <sam@webkit.org> 2 3 Reviewed by Darin Adler. 4 5 Fix intermittent crash in buildbot. The CSSCursorImageValues and 6 SVGCursorElements held onto raw SVGElement pointers without any 7 guarantee that the element is still around. 8 9 We did not fix the design that resulted in this issue, we just fixed 10 the pointer lifetimes. 11 12 * css/CSSCursorImageValue.cpp: 13 (WebCore::CSSCursorImageValue::~CSSCursorImageValue): Zero out the back pointers. 14 (WebCore::CSSCursorImageValue::updateIfSVGCursorIsUsed): Set up a back pointer. 15 (WebCore::CSSCursorImageValue::removeReferencedElement): Added. Used when the element 16 is destroyed. 17 * css/CSSCursorImageValue.h: Added removeReferencedElement. 18 19 * svg/SVGCursorElement.cpp: 20 (WebCore::SVGCursorElement::~SVGCursorElement): Zero out the back pointers. 21 (WebCore::SVGCursorElement::addClient): Set up a back pointer. 22 (WebCore::SVGCursorElement::removeClient): Zero out the back pointer. 23 24 * svg/SVGElement.cpp: 25 (WebCore::SVGElement::SVGElement): Initialize back pointers to zero. 26 (WebCore::SVGElement::~SVGElement): Call both the element and cursor image value 27 to remove the element from their sets. 28 * svg/SVGElement.h: 29 (WebCore::SVGElement::setCursorElement): Added. 30 (WebCore::SVGElement::setCursorImageValue): Added. 31 1 32 2008-12-09 David Hyatt <hyatt@apple.com> 2 33 -
trunk/WebCore/css/CSSCursorImageValue.cpp
r36700 r39149 71 71 for (; it != end; ++it) { 72 72 SVGElement* referencedElement = *it; 73 referencedElement->setCursorImageValue(0); 73 74 if (SVGCursorElement* cursorElement = resourceReferencedByCursorElement(url, referencedElement->document())) 74 75 cursorElement->removeClient(referencedElement); … … 99 100 SVGElement* svgElement = static_cast<SVGElement*>(element); 100 101 m_referencedElements.add(svgElement); 102 svgElement->setCursorImageValue(this); 101 103 cursorElement->addClient(svgElement); 102 104 return true; … … 121 123 } 122 124 125 #if ENABLE(SVG) 126 void CSSCursorImageValue::removeReferencedElement(SVGElement* element) 127 { 128 m_referencedElements.remove(element); 129 } 130 #endif 131 123 132 } // namespace WebCore -
trunk/WebCore/css/CSSCursorImageValue.h
r34627 r39149 45 45 virtual StyleCachedImage* cachedImage(DocLoader*); 46 46 47 #if ENABLE(SVG) 48 void removeReferencedElement(SVGElement*); 49 #endif 50 47 51 private: 48 52 CSSCursorImageValue(const String& url, const IntPoint& hotspot); -
trunk/WebCore/svg/SVGCursorElement.cpp
r39065 r39149 45 45 SVGCursorElement::~SVGCursorElement() 46 46 { 47 HashSet<SVGElement*>::iterator end = m_clients.end(); 48 for (HashSet<SVGElement*>::iterator it = m_clients.begin(); it != end; ++it) 49 (*it)->setCursorElement(0); 47 50 } 48 51 … … 68 71 { 69 72 m_clients.add(element); 73 element->setCursorElement(this); 70 74 } 71 75 … … 73 77 { 74 78 m_clients.remove(element); 79 element->setCursorElement(0); 75 80 } 76 81 -
trunk/WebCore/svg/SVGElement.cpp
r38094 r39149 26 26 #include "SVGElement.h" 27 27 28 #include "CSSCursorImageValue.h" 28 29 #include "DOMImplementation.h" 29 30 #include "Document.h" … … 34 35 #include "HTMLNames.h" 35 36 #include "PlatformString.h" 37 #include "RegisteredEventListener.h" 36 38 #include "RenderObject.h" 39 #include "SVGCursorElement.h" 37 40 #include "SVGDocumentExtensions.h" 38 41 #include "SVGElementInstance.h" … … 43 46 #include "SVGUseElement.h" 44 47 #include "XMLNames.h" 45 #include "RegisteredEventListener.h"46 48 47 49 namespace WebCore { … … 52 54 : StyledElement(tagName, doc) 53 55 , m_shadowParent(0) 56 , m_cursorElement(0) 57 , m_cursorImageValue(0) 54 58 { 55 59 } … … 57 61 SVGElement::~SVGElement() 58 62 { 63 if (m_cursorElement) 64 m_cursorElement->removeClient(this); 65 if (m_cursorImageValue) 66 m_cursorImageValue->removeReferencedElement(this); 59 67 } 60 68 -
trunk/WebCore/svg/SVGElement.h
r36823 r39149 32 32 33 33 class AffineTransform; 34 class CSSCursorImageValue; 34 35 class Document; 36 class SVGCursorElement; 37 class SVGDocumentExtensions; 35 38 class SVGElementInstance; 36 class SVGDocumentExtensions;37 39 class SVGSVGElement; 38 40 … … 118 120 } 119 121 122 void setCursorElement(SVGCursorElement* cursorElement) { m_cursorElement = cursorElement; } 123 void setCursorImageValue(CSSCursorImageValue* cursorImageValue) { m_cursorImageValue = cursorImageValue; } 124 120 125 private: 121 126 friend class SVGElementInstance; … … 129 134 mutable HashMap<String, const SVGAnimatedPropertyBase*> m_svgPropertyMap; 130 135 136 SVGCursorElement* m_cursorElement; 137 CSSCursorImageValue* m_cursorImageValue; 138 131 139 HashSet<SVGElementInstance*> m_elementInstances; 132 140 };
Note:
See TracChangeset
for help on using the changeset viewer.