⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 273809 in webkit


Ignore:
Timestamp:
Mar 2, 2021, 8:52:00 PM (6 years ago)
Author:
commit-queue@webkit.org
Message:

Crash in removeSymbolElementsFromSubtree()
​https://bugs.webkit.org/show_bug.cgi?id=222397

Patch by Julian Gonzalez <​julian_a_gonzalez@apple.com> on 2021-03-02
Reviewed by Ryosuke Niwa.

Skip children in removeSymbolElementsFromSubtree(), so that
we don't see nodes that have been removed.

Thanks to Darin Adler for the initial version of this patch
and Ryosuke Niwa for refinements.

  • svg/SVGUseElement.cpp:

(WebCore::SVGUseElement::updateShadowTree):
(WebCore::removeSymbolElementsFromSubtree):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r273805 r273809  
     12021-03-02  Julian Gonzalez  <julian_a_gonzalez@apple.com>
     2
     3        Crash in removeSymbolElementsFromSubtree()
     4        https://bugs.webkit.org/show_bug.cgi?id=222397
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        Skip children in removeSymbolElementsFromSubtree(), so that
     9        we don't see nodes that have been removed.
     10
     11        Thanks to Darin Adler for the initial version of this patch
     12        and Ryosuke Niwa for refinements.
     13
     14        * svg/SVGUseElement.cpp:
     15        (WebCore::SVGUseElement::updateShadowTree):
     16        (WebCore::removeSymbolElementsFromSubtree):
     17
    1182021-03-02  Zalan Bujtas  <zalan@apple.com>
    219
  • trunk/Source/WebCore/svg/SVGUseElement.cpp

    r261597 r273809  
    225225    if (!isConnected())
    226226        return;
     227
     228    ScriptDisallowedScope::InMainThread scriptDisallowedScope;
     229
    227230    document().removeSVGUseElement(*this);
    228231
    … …  
    351354    // but incorrect for ones that just happen to be in a subtree.
    352355    Vector<Element*> symbolElements;
    353     for (auto& descendant : descendantsOfType<SVGSymbolElement>(subtree))
    354         symbolElements.append(&descendant);
     356    for (auto it = descendantsOfType<Element>(subtree).begin(); it; ) {
     357        if (is<SVGSymbolElement>(*it)) {
     358            symbolElements.append(&*it);
     359            it.traverseNextSkippingChildren();
     360            continue;
     361        }
     362        ++it;
     363    }
    355364    disassociateAndRemoveClones(symbolElements);
    356365}
Note: See TracChangeset for help on using the changeset viewer.