2020#import " NSInvocation+OCMAdditions.h"
2121#import " OCMFunctionsPrivate.h"
2222#import " NSMethodSignature+OCMAdditions.h"
23- # import " NSObject+OCMAdditions.h "
23+
2424
2525#if (TARGET_OS_OSX && (!defined(__MAC_10_10) || __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_10)) || \
2626 (TARGET_OS_IPHONE && (!defined (__IPHONE_8_0) || __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_8_0))
@@ -30,6 +30,7 @@ static BOOL OCMObjectIsClass(id object) {
3030#define object_isClass OCMObjectIsClass
3131#endif
3232
33+
3334@implementation NSInvocation (OCMAdditions)
3435
3536+ (NSInvocation *)invocationForBlock : (id )block withArguments : (NSArray *)arguments
@@ -65,7 +66,7 @@ - (void)retainObjectArgumentsExcludingObject:(id)objectToExclude
6566 NSMutableArray *retainedArguments = [[NSMutableArray alloc ] init ];
6667
6768 id target = [self target ];
68- if ((target != nil ) && (target != objectToExclude) && !object_isClass (target) && ![ target _isDeallocating ] )
69+ if ((target != nil ) && (target != objectToExclude) && !object_isClass (target) && !OCMIsDeallocating ( target) )
6970 {
7071 // Bad things will happen if the target is a block since it's not being
7172 // copied. There isn't a very good way to tell if an invocation's target
@@ -83,7 +84,7 @@ - (void)retainObjectArgumentsExcludingObject:(id)objectToExclude
8384 {
8485 id argument;
8586 [self getArgument: &argument atIndex: index];
86- if ((argument != nil ) && (argument != objectToExclude) && ![ argument _isDeallocating ] )
87+ if ((argument != nil ) && (argument != objectToExclude) && !OCMIsDeallocating ( argument) )
8788 {
8889 if (OCMIsBlockType (argumentType))
8990 {
@@ -105,7 +106,7 @@ - (void)retainObjectArgumentsExcludingObject:(id)objectToExclude
105106 {
106107 id returnValue;
107108 [self getReturnValue: &returnValue];
108- if ((returnValue != nil ) && (returnValue != objectToExclude) && ![ returnValue _isDeallocating ] )
109+ if ((returnValue != nil ) && (returnValue != objectToExclude) && !OCMIsDeallocating ( returnValue) )
109110 {
110111 if (OCMIsBlockType (returnType))
111112 {
0 commit comments