Commit a6f5100
Mitigate deadlock hazard in RCTUtils.m
Summary:
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: cipolleschi
Differential Revision: D73058551
fbshipit-source-id: 9d14b5556748288227cfb93940f79d44997d7b471 parent 929099f commit a6f5100
1 file changed
+2
-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 | + | |
47 | 41 | | |
48 | 42 | | |
49 | 43 | | |
| |||
52 | 46 | | |
53 | 47 | | |
54 | 48 | | |
55 | | - | |
56 | 49 | | |
57 | 50 | | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
| 51 | + | |
65 | 52 | | |
66 | 53 | | |
67 | 54 | | |
| |||
0 commit comments