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 "ABI48_0_0ManagedObjectWrapper.h" 9 10#if TARGET_OS_MAC 11 12namespace ABI48_0_0facebook { 13namespace ABI48_0_0React { 14namespace detail { 15 16void wrappedManagedObjectDeleter(void *cfPointer) noexcept 17{ 18 // A shared pointer does call custom deleter on `nullptr`s. 19 // This is somewhat counter-intuitively but makes sense considering the type-erasured nature of shared pointer and an 20 // aliasing constructor feature. `CFRelease` crashes on null pointer though. Therefore we must check for this case 21 // explicitly. 22 if (cfPointer == NULL) { 23 return; 24 } 25 26 CFRelease(cfPointer); 27} 28 29} // namespace detail 30} // namespace ABI48_0_0React 31} // namespace ABI48_0_0facebook 32 33@implementation ABI48_0_0RCTInternalGenericWeakWrapper 34@end 35 36#endif 37