Commit aa41184
Take 2: Mitigate deadlock hazard in RCTUtils.m (#50807)
Summary:
Pull Request resolved: #50807
This structure is unsafe:
```
// In each native module:
+load
dispatch_once
NSBundle mainBundle
```
NSBundle mainBundle itself uses dispatch_once during initialization. If that initialization triggers a native module class load, we could end up with a circular dependency chain. This could deadlock the application.
## Changes
Just remove the dispatch_once. Getting the NSBundle mainBundle is very efficient after the first access. And NSBundle objectForInfoDictionaryKey is also very efficient.
Created from CodeHub with https://fburl.com/edit-in-codehub
Changelog: [Internal]
Reviewed By: NickGerleman
Differential Revision: D73265906
fbshipit-source-id: f718e5bba7e95517613204b1f95e1b637e6c23661 parent 5b5cf0e commit aa41184
1 file changed
+5
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
39 | 38 | | |
40 | 39 | | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
| 40 | + | |
| 41 | + | |
47 | 42 | | |
48 | 43 | | |
49 | 44 | | |
| |||
52 | 47 | | |
53 | 48 | | |
54 | 49 | | |
55 | | - | |
56 | 50 | | |
57 | 51 | | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
65 | 55 | | |
66 | 56 | | |
67 | 57 | | |
| |||
0 commit comments