diff --git a/change/react-native-windows-fd21e9f2-3f90-4b4a-94f5-fbf8802080dc.json b/change/react-native-windows-fd21e9f2-3f90-4b4a-94f5-fbf8802080dc.json new file mode 100644 index 00000000000..82689dec243 --- /dev/null +++ b/change/react-native-windows-fd21e9f2-3f90-4b4a-94f5-fbf8802080dc.json @@ -0,0 +1,7 @@ +{ + "type": "prerelease", + "comment": "Fix multiline TextInput crash from TxDrawD2D reentrancy", + "packageName": "react-native-windows", + "email": "74712637+iamAbhi-916@users.noreply.github.com", + "dependentChangeType": "patch" +} diff --git a/vnext/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp b/vnext/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp index 59cbe03aa61..7a5f30d8a66 100644 --- a/vnext/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +++ b/vnext/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp @@ -1780,7 +1780,10 @@ void WindowsTextInputComponentView::DrawText() noexcept { } // TODO keep track of proper invalid rect + // Prevent reentrancy: TxDrawD2D may call TxViewChange -> DrawText + m_cDrawBlock++; auto hrDraw = m_textServices->TxDrawD2D(d2dDeviceContext, &rc, nullptr, TXTVIEW_ACTIVE); + m_cDrawBlock--; winrt::check_hresult(hrDraw); // draw placeholder text if needed