From 8464e3cdaa1b9b656350df3dc5f4254cbdc2adbc Mon Sep 17 00:00:00 2001 From: "gtm.daemon" Date: Mon, 5 Apr 2010 17:33:46 +0000 Subject: [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) --- Foundation/GTMLightweightProxyTest.m | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'Foundation/GTMLightweightProxyTest.m') 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]; -- cgit v1.2.3