[Webkit-unassigned] [Bug 21004] SVG animation example asserts

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Sep 22 14:01:34 PDT 2008


https://bugs.webkit.org/show_bug.cgi?id=21004





------- Comment #2 from simon.fraser at apple.com  2008-09-22 14:01 PDT -------
Here's a hacky fix:

diff --git a/WebCore/svg/SVGDocumentExtensions.cpp
b/WebCore/svg/SVGDocumentExtensions.cpp
index 98e6d68..c5fc040 100644
--- a/WebCore/svg/SVGDocumentExtensions.cpp
+++ b/WebCore/svg/SVGDocumentExtensions.cpp
@@ -66,10 +66,19 @@ void SVGDocumentExtensions::startAnimations()
 {
     // FIXME: Eventually every "Time Container" will need a way to latch on to
some global timer
     // starting animations for a document will do this "latching"
-#if ENABLE(SVG_ANIMATION)    
-    HashSet<SVGSVGElement*>::iterator end = m_timeContainers.end();
-    for (HashSet<SVGSVGElement*>::iterator itr = m_timeContainers.begin(); itr
!= end; ++itr)
-        (*itr)->timeContainer()->begin();
+#if ENABLE(SVG_ANIMATION)
+
+    // Make a copy, since calling begin() on a timeContainer may call back
into
+    // addTimeContainer/removeTimeContainer and change the HashSet.
+    HashSet<SVGSVGElement*> timeContainersCopy(m_timeContainers);
+    
+    HashSet<SVGSVGElement*>::iterator end = timeContainersCopy.end();
+    for (HashSet<SVGSVGElement*>::iterator itr = timeContainersCopy.begin();
itr != end; ++itr)
+    {
+        // FIXME: hack
+        if (m_timeContainers.find(*itr) != m_timeContainers.end())
+            (*itr)->timeContainer()->begin();
+    }
 #endif
 }


Note that copying the HashSet is required to avoid modification during
enumeration, and the .find() check is required because SVGSVGElements can be
destroyed in begin() callbacks. It seems like m_timeContainers needs to hold
references to SVG elements.


-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the webkit-unassigned mailing list