Skip to content

Commit

Permalink
Added the -fobjc-arc-exceptions compiler flag. Exceptions leak memory…
Browse files Browse the repository at this point in the history
… under ARC without this flag.
  • Loading branch information
logancollins committed Aug 8, 2012
1 parent 7179136 commit e8e770f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions Mocha.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1341,6 +1341,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 5.0;
MACOSX_DEPLOYMENT_TARGET = 10.7;
ONLY_ACTIVE_ARCH = YES;
OTHER_CFLAGS = "-fobjc-arc-exceptions";
SDKROOT = macosx;
};
name = Debug;
Expand All @@ -1362,6 +1363,7 @@
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 5.0;
MACOSX_DEPLOYMENT_TARGET = 10.7;
OTHER_CFLAGS = "-fobjc-arc-exceptions";
SDKROOT = macosx;
};
name = Release;
Expand Down
8 changes: 4 additions & 4 deletions Mocha/Utilities/MOUtilities.m
Original file line number Diff line number Diff line change
Expand Up @@ -330,16 +330,16 @@ JSValueRef MOFunctionInvoke(id function, JSContextRef ctx, size_t argumentCount,

// Determine the method type
if (classMethod) {
method = class_getClassMethod([target class], selector);
method = class_getClassMethod(klass, selector);
}
else {
method = class_getInstanceMethod([target class], selector);
method = class_getInstanceMethod(klass, selector);
}

variadic = MOSelectorIsVariadic(klass, selector);

if (method == NULL) {
NSException *e = [NSException exceptionWithName:MORuntimeException reason:[NSString stringWithFormat:@"Unable to locate method %@ of class %@", NSStringFromSelector(selector), [target class]] userInfo:nil];
NSException *e = [NSException exceptionWithName:MORuntimeException reason:[NSString stringWithFormat:@"Unable to locate method %@ of class %@", NSStringFromSelector(selector), klass] userInfo:nil];
if (exception != NULL) {
*exception = [runtime JSValueForObject:e];
}
Expand All @@ -350,7 +350,7 @@ JSValueRef MOFunctionInvoke(id function, JSContextRef ctx, size_t argumentCount,
argumentEncodings = [MOParseObjCMethodEncoding(encoding) mutableCopy];

if (argumentEncodings == nil) {
NSException *e = [NSException exceptionWithName:MORuntimeException reason:[NSString stringWithFormat:@"Unable to parse method encoding for method %@ of class %@", NSStringFromSelector(selector), [target class]] userInfo:nil];
NSException *e = [NSException exceptionWithName:MORuntimeException reason:[NSString stringWithFormat:@"Unable to parse method encoding for method %@ of class %@", NSStringFromSelector(selector), klass] userInfo:nil];
if (exception != NULL) {
*exception = [runtime JSValueForObject:e];
}
Expand Down

0 comments on commit e8e770f

Please sign in to comment.