From 5699959d39601f7a1be1fc9b350b18d37cf2e5e0 Mon Sep 17 00:00:00 2001 From: rfm Date: Sun, 21 Jul 2024 09:46:33 +0100 Subject: [PATCH] zeroing weak memory is now treated as weak memory since GC has been dropped --- Source/NSConcretePointerFunctions.m | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/Source/NSConcretePointerFunctions.m b/Source/NSConcretePointerFunctions.m index 85e6c11b2..a16bc7504 100644 --- a/Source/NSConcretePointerFunctions.m +++ b/Source/NSConcretePointerFunctions.m @@ -186,13 +186,24 @@ - (id) initWithOptions: (NSPointerFunctionsOptions)options DESTROY(self);\ }) - _x.options = options; + if (memoryType(options, NSPointerFunctionsZeroingWeakMemory)) + { + /* Garbage Collection is no longer supported, so we treat all weak + * memory the same way. + */ + _x.options = (options & 0xffffff00) | NSPointerFunctionsWeakMemory; + } + else + { + _x.options = options; + } /* First we look at the memory management options to see which function * should be used to relinquish contents of a container with these * options. */ - if (memoryType(options, NSPointerFunctionsZeroingWeakMemory)) + if (memoryType(options, NSPointerFunctionsWeakMemory) + || memoryType(options, NSPointerFunctionsZeroingWeakMemory)) { _x.relinquishFunction = 0; } @@ -234,7 +245,8 @@ - (id) initWithOptions: (NSPointerFunctionsOptions)options } else if (personalityType(options, NSPointerFunctionsObjectPointerPersonality)) { - if (memoryType(options, NSPointerFunctionsZeroingWeakMemory)) + if (memoryType(options, NSPointerFunctionsWeakMemory) + || memoryType(options, NSPointerFunctionsZeroingWeakMemory)) { _x.acquireFunction = 0; } @@ -284,7 +296,8 @@ - (id) initWithOptions: (NSPointerFunctionsOptions)options } else /* objects */ { - if (memoryType(options, NSPointerFunctionsZeroingWeakMemory)) + if (memoryType(options, NSPointerFunctionsWeakMemory) + || memoryType(options, NSPointerFunctionsZeroingWeakMemory)) { _x.acquireFunction = 0; }