aboutsummaryrefslogtreecommitdiff
path: root/Foundation/GTMLightweightProxyTest.m
diff options
context:
space:
mode:
authorGravatar gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2010-04-05 17:33:46 +0000
committerGravatar gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2010-04-05 17:33:46 +0000
commit8464e3cdaa1b9b656350df3dc5f4254cbdc2adbc (patch)
treefab7c2f46696be18bcf902439ca2b4ec6e3364e0 /Foundation/GTMLightweightProxyTest.m
parent749900bde6560d275418871bff922df9cf1e9643 (diff)
[Author: dmaclach]
Subtle issue in GTMLightweightProxy where it would leak (and return nil) if you initialized it using a standard alloc] init] pattern instead if initWithRepresentedObject:]. The init call would go to the proxy which being nil would return nil, and you'd end up with both a leak and a nil pointer nasty. R=thomasvl DELTA=13 (13 added, 0 deleted, 0 changed)
Diffstat (limited to 'Foundation/GTMLightweightProxyTest.m')
-rw-r--r--Foundation/GTMLightweightProxyTest.m9
1 files changed, 9 insertions, 0 deletions
diff --git a/Foundation/GTMLightweightProxyTest.m b/Foundation/GTMLightweightProxyTest.m
index e50a9dc..01a1bb2 100644
--- a/Foundation/GTMLightweightProxyTest.m
+++ b/Foundation/GTMLightweightProxyTest.m
@@ -30,6 +30,15 @@
@implementation GTMLightweightProxyTest
+- (void)testInit {
+ id proxy = [[[GTMLightweightProxy alloc]
+ initWithRepresentedObject:self] autorelease];
+ STAssertNotNil(proxy, nil);
+
+ proxy = [[[GTMLightweightProxy alloc] init] autorelease];
+ STAssertNotNil(proxy, nil);
+}
+
- (void)testProxy {
id proxy
= [[[GTMLightweightProxy alloc] initWithRepresentedObject:self] autorelease];