1/* 2 * Copyright (c) Meta Platforms, Inc. and affiliates. 3 * 4 * This source code is licensed under the MIT license found in the 5 * LICENSE file in the root directory of this source tree. 6 */ 7 8#include "ABI47_0_0ManagedObjectWrapper.h" 9 10#if defined(__OBJC__) && defined(__cplusplus) 11#if TARGET_OS_MAC && TARGET_OS_IPHONE 12 13namespace ABI47_0_0facebook { 14namespace ABI47_0_0React { 15namespace detail { 16 17void wrappedManagedObjectDeleter(void *cfPointer) noexcept 18{ 19 // A shared pointer does call custom deleter on `nullptr`s. 20 // This is somewhat counter-intuitively but makes sense considering the type-erasured nature of shared pointer and an 21 // aliasing constructor feature. `CFRelease` crashes on null pointer though. Therefore we must check for this case 22 // explicitly. 23 if (cfPointer == NULL) { 24 return; 25 } 26 27 CFRelease(cfPointer); 28} 29 30} // namespace detail 31} // namespace ABI47_0_0React 32} // namespace ABI47_0_0facebook 33 34@implementation ABI47_0_0RCTInternalGenericWeakWrapper 35@end 36 37#endif 38#endif 39