Skip to content

Commit

Permalink
Fix RootComponentView leak (microsoft#13959)
Browse files Browse the repository at this point in the history
* Fix RootComponentView leak

* Change files

* format

---------

Co-authored-by: React-Native-Windows Bot <53619745+rnbot@users.noreply.github.com>
  • Loading branch information
acoates-ms and rnbot committed Oct 16, 2024
1 parent 9de1141 commit 10abaca
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "Fix RootComponentView leak",
"packageName": "react-native-windows",
"email": "53619745+rnbot@users.noreply.github.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ void ReactNativeIsland::ReactViewHost(winrt::Microsoft::ReactNative::IReactViewH
}

if (m_reactViewHost) {
UninitRootView();
m_reactViewHost.DetachViewInstance();
}

Expand Down
3 changes: 3 additions & 0 deletions vnext/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@ void FabricUIManager::startSurface(

void FabricUIManager::stopSurface(facebook::react::SurfaceId surfaceId) noexcept {
m_surfaceManager->stopSurface(surfaceId);
auto &rootDescriptor = m_registry.componentViewDescriptorWithTag(surfaceId);
m_registry.enqueueComponentViewWithComponentHandle(
facebook::react::RootShadowNode::Handle(), surfaceId, rootDescriptor);
}

winrt::Microsoft::ReactNative::ReactNativeIsland FabricUIManager::GetReactNativeIsland(
Expand Down

0 comments on commit 10abaca

Please sign in to comment.