Skip to content

Commit 20ee528

Browse files
committed
Fix race in UiThreadUtil main handler lazy initialization
1 parent 8d658f4 commit 20ee528

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

  • packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge

‎packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/UiThreadUtil.kt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import com.facebook.react.common.build.ReactBuildConfig
1515
public object UiThreadUtil {
1616

1717
private val mainHandler: Handler by
18-
lazy(LazyThreadSafetyMode.NONE) { Handler(Looper.getMainLooper()) }
18+
lazy(LazyThreadSafetyMode.SYNCHRONIZED) { Handler(Looper.getMainLooper()) }
1919

2020
/**
2121
* Returns the handler associated with the main (UI) thread.

0 commit comments

Comments
 (0)