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
This commit is contained in:
Родитель
6f99beff7e
Коммит
208e4d2dcd
|
@ -27,18 +27,7 @@ namespace detail {
|
||||||
* A custom deleter used for the deallocation of Objective-C managed objects.
|
* A custom deleter used for the deallocation of Objective-C managed objects.
|
||||||
* To be used only by `wrapManagedObject`.
|
* To be used only by `wrapManagedObject`.
|
||||||
*/
|
*/
|
||||||
static void wrappedManagedObjectDeleter(void *cfPointer) noexcept
|
void wrappedManagedObjectDeleter(void *cfPointer) noexcept;
|
||||||
{
|
|
||||||
// A shared pointer does call custom deleter on `nullptr`s.
|
|
||||||
// This is somewhat counter-intuitively but makes sense considering the type-erasured nature of shared pointer and an
|
|
||||||
// aliasing constructor feature. `CFRelease` crashes on null pointer though. Therefore we must check for this case
|
|
||||||
// explicitly.
|
|
||||||
if (cfPointer == NULL) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
CFRelease(cfPointer);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,27 @@
|
||||||
#if defined(__OBJC__) && defined(__cplusplus)
|
#if defined(__OBJC__) && defined(__cplusplus)
|
||||||
#if TARGET_OS_MAC && TARGET_OS_IPHONE
|
#if TARGET_OS_MAC && TARGET_OS_IPHONE
|
||||||
|
|
||||||
|
namespace facebook {
|
||||||
|
namespace react {
|
||||||
|
namespace detail {
|
||||||
|
|
||||||
|
void wrappedManagedObjectDeleter(void *cfPointer) noexcept
|
||||||
|
{
|
||||||
|
// A shared pointer does call custom deleter on `nullptr`s.
|
||||||
|
// This is somewhat counter-intuitively but makes sense considering the type-erasured nature of shared pointer and an
|
||||||
|
// aliasing constructor feature. `CFRelease` crashes on null pointer though. Therefore we must check for this case
|
||||||
|
// explicitly.
|
||||||
|
if (cfPointer == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CFRelease(cfPointer);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace detail
|
||||||
|
} // namespace react
|
||||||
|
} // namespace facebook
|
||||||
|
|
||||||
@implementation RCTInternalGenericWeakWrapper
|
@implementation RCTInternalGenericWeakWrapper
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче