Commit Graph

6 Commits

Author SHA1 Message Date
Vitaly Potlov 208e4d2dcd Fix static method in file header (#29118)
Summary:
I have looked into recent commits and found a typical mistake when static is used in .h file.
Here static is not necessary. See link: https://stackoverflow.com/questions/780730/c-c-static-function-in-header-file-what-does-it-mean

## Changelog
Changelog: [Internal] Fabric-specific internal change.
Pull Request resolved: https://github.com/facebook/react-native/pull/29118

Reviewed By: sammy-SC

Differential Revision: D22039305

Pulled By: shergin

fbshipit-source-id: 7078e716166067dd1e94cbb84200a1235283c978
2020-06-24 12:30:45 -07:00
Valentin Shergin 2a80579ea1 Fabric: Checking for nullptr before calling CFRelease in ManagedObjectWrapper
Summary:
ManagedObjectWrapper (`wrapManagedObject`) is used to pass pointers managed by Objective-C runtime object thought C++ parts of the framework. The wrapper consists of a shared pointer to an object with a custom deleter that calls `CFRelease`.
Apparently, there is a caveat here: shared ptr implementation always calls a deleter even if the object points to `nullptr`. It's usually fine because in C++ calling `delete` on a nullptr is a no-op, not an error. But it's an error from the `CFRelease` perspective, which checks the pointer and crashes if it's nullptr.

More info:
https://stackoverflow.com/questions/1135214/why-would-cfreleasenull-crash
https://stackoverflow.com/questions/50201967/why-unique-ptr-with-custom-deleter-wont-work-for-nullptr-while-shared-ptr-does

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D21943011

fbshipit-source-id: 442ad5e274a146de112e6bd8f3c2d20f0225bf77
2020-06-09 12:40:42 -07:00
Valentin Shergin ede2c5031f Codemod: Clang-format for all files in ReactCommon directory
Summary:
We are moving towards 100%-prettified files. That's the first step when we apply Clang Format for `ReactCommon`.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D20110895

fbshipit-source-id: 0a0ce4997cf1c3721b0b07ef78c1a57ce87d20f9
2020-02-25 19:52:27 -08:00
Andres Suarez 3b31e69e28 Tidy up license headers [2/n]
Summary: Changelog: [General] [Fixed] - License header cleanup

Reviewed By: yungsters

Differential Revision: D17952694

fbshipit-source-id: 17c87de7ebb271fa2ac8d00af72a4d1addef8bd0
2019-10-16 10:06:34 -07:00
Valentin Shergin 18ec9328b4 Fabric: Weak semantic to ManagedObjectWrapper
Summary: We need to have a weak semantic for the ManagedObjectWrapper, this diff implements that.

Reviewed By: sammy-SC

Differential Revision: D17773699

fbshipit-source-id: 978fa62191361c3b2c0e46c423240831ed1dd233
2019-10-09 13:17:42 -07:00
Valentin Shergin a0523da53d Fabric: Moving RNWrapManagedObject to react/utils module
Summary: Apparently we can/should not have in RCTConversions because it creates unnecessary dependency to core iOS module.

Reviewed By: mdvacca

Differential Revision: D15055325

fbshipit-source-id: 507f5a40c03b5c261967de4504297d31ecd02783
2019-04-29 21:21:11 -07:00