Chromium Code Reviews| Index: Source/core/svg/SVGFontFaceElement.cpp |
| diff --git a/Source/core/svg/SVGFontFaceElement.cpp b/Source/core/svg/SVGFontFaceElement.cpp |
| index 5430c487dadf2cf79be4c93abfa771b2034189b5..032b162e0f88ef9e96605efd550b52347c438a0e 100644 |
| --- a/Source/core/svg/SVGFontFaceElement.cpp |
| +++ b/Source/core/svg/SVGFontFaceElement.cpp |
| @@ -331,14 +331,20 @@ void SVGFontFaceElement::removedFrom(ContainerNode* rootParent) |
| if (rootParent->inDocument()) { |
| m_fontElement = 0; |
| document().accessSVGExtensions().unregisterSVGFontFaceElement(this); |
| + |
| // FIXME: HTMLTemplateElement's document or imported document can be active? |
| // If so, we also need to check whether fontSelector() is nullptr or not. |
| // Otherwise, we will use just document().isActive() here. |
| - if (document().isActive() && document().styleEngine()->fontSelector()) |
| + RecalcStyleTime recalcTime = RecalcStyleDeferred; |
| + if (document().isActive() && document().styleEngine()->fontSelector()) { |
| document().styleEngine()->fontSelector()->fontFaceCache()->remove(m_fontFaceRule.get()); |
| + // This SVGFontFaceElement might be referred from some render style. |
| + // If this SVGFontFaceElement is used via the render style before recalc style, |
| + // heap-use-after-free will occur. We need to quickly update render style. |
| + recalcTime = RecalcStyleImmediately; |
|
esprehn
2014/03/17 17:12:01
This is bad, it means if you have a bunch of fonts
tasak
2014/03/18 02:23:04
I agree that this is a bad solution.
|
| + } |
| m_fontFaceRule->mutableProperties().clear(); |
| - |
| - document().styleResolverChanged(RecalcStyleDeferred); |
| + document().styleResolverChanged(recalcTime); |
| } else |
| ASSERT(!m_fontElement); |
| } |