Files
react-native/ReactCommon/utils/ManagedObjectWrapper.mm
T
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

39 lines
950 B
Plaintext

/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#include "ManagedObjectWrapper.h"
#if defined(__OBJC__) && defined(__cplusplus)
#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
@end
#endif
#endif