react-native/ReactCommon/fabric/imagemanager/platform/ios
Valentin Shergin c03bf5d2b0 Fabric: Fixed crash caused by preluminary deallocation of RCTImageLoader
Summary:
The spec says that `bridge_transfer` indicates that we "transfer ownership of the pointer" to ARC which implies that as soon this part of the code does not need the object, it will be deallocated. However, that's not what we want here. This object is actually already owned by another ARC-powered code somewhere else and the pointer to it was transferred as a raw pointer through the C++ world.
So, we want to keep the ownership of the object on the other side but still imply the lifetime of the object. So how can we do that? Simple, we have to use `bridge`.
Why? ARC is not magical, it's just automatic ref counting. And I think the only difference between `bridge` and `bridge_transfer` is how many refcounter's bumps will be added to the generated code. In the case of `bridge_transfer` it is zero, in the case of `bridge` it is one. So, initializing a new Objective-C variable that points to the shared resource we have to bump the counter once, so we have to use `bridge`.

Reviewed By: mdvacca

Differential Revision: D9819405

fbshipit-source-id: 9e7af343917ec4407a64d884402b10ee2a8097f9
2018-09-14 15:21:12 -07:00
..
ImageManager.mm Fabric: Fixed crash caused by preluminary deallocation of RCTImageLoader 2018-09-14 15:21:12 -07:00
RCTImageManager.h Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTImageManager.mm Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTImagePrimitivesConversions.h Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00