Permalink
Browse files

Added the -fobjc-arc-exceptions compiler flag. Exceptions leak memory…

… under ARC without this flag.
  • Loading branch information...
logancollins committed Aug 8, 2012
1 parent 7179136 commit e8e770f6bb03cee686d7e8fcaf24ffff11b5894f
Showing with 6 additions and 4 deletions.
  1. +2 −0 Mocha.xcodeproj/project.pbxproj
  2. +4 −4 Mocha/Utilities/MOUtilities.m
@@ -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;
@@ -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;
@@ -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];
}
@@ -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];
}

0 comments on commit e8e770f

Please sign in to comment.