diff --git a/Source/GSFileHandle.m b/Source/GSFileHandle.m index 6de02101d..055fd6feb 100644 --- a/Source/GSFileHandle.m +++ b/Source/GSFileHandle.m @@ -964,7 +964,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr"; else { self = [self initWithFileDescriptor: 2 closeOnDealloc: NO]; - fh_stderr = self; + ASSIGN(fh_stderr, self); if (self) { readOK = NO; @@ -982,7 +982,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr"; else { self = [self initWithFileDescriptor: 0 closeOnDealloc: NO]; - fh_stdin = self; + ASSIGN(fh_stdin, self); if (self) { writeOK = NO; @@ -1000,7 +1000,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr"; else { self = [self initWithFileDescriptor: 1 closeOnDealloc: NO]; - fh_stdout = self; + ASSIGN(fh_stdout, self); if (self) { readOK = NO; diff --git a/Tests/base/NSFileHandle/singleton.m b/Tests/base/NSFileHandle/singleton.m new file mode 100644 index 000000000..059061379 --- /dev/null +++ b/Tests/base/NSFileHandle/singleton.m @@ -0,0 +1,16 @@ +#import + +id a,b,c; + +int main(void) +{ + NSAutoreleasePool *p = [NSAutoreleasePool new]; + NSZombieEnabled = YES; + a = [NSFileHandle fileHandleWithStandardInput]; + b = [NSFileHandle fileHandleWithStandardOutput]; + c = [NSFileHandle fileHandleWithStandardError]; + [p drain]; + assert(0 != [a description]); + assert(0 != [b description]); + assert(0 != [c description]); +}