Fix crash when SVG is unloaded by XAML (#2195)

XAML may unload the root SVG panel, which will trigger a recursive unload. For GroupView, this unload will clear the child collection. However, active operations on the SVG from the React Native UIManager may still be in flight, in which case we may attempt to remove a child that has already been cleared by the root unload.
This commit is contained in:
Eric Rozell
2024-01-03 09:48:22 -05:00
committed by GitHub
parent d1b02154e3
commit 07b9ca53f4
4 changed files with 13 additions and 6 deletions

View File

@@ -358,6 +358,7 @@ void RenderableView::Unload() {
m_propList.clear();
m_propSetMap.clear();
m_strokeDashArray.Clear();
m_isUnloaded = true;
}
RNSVG::IRenderable RenderableView::HitTest(Point const &point) {
@@ -370,7 +371,7 @@ RNSVG::IRenderable RenderableView::HitTest(Point const &point) {
if (auto const &svgRoot{SvgRoot()}) {
float canvasDiagonal{Utils::GetCanvasDiagonal(svgRoot.ActualSize())};
float strokeWidth{Utils::GetAbsoluteLength(StrokeWidth(), canvasDiagonal)};
check_hresult(geometry->StrokeContainsPoint(pointD2D, strokeWidth, nullptr, nullptr, &strokeContainsPoint));
}