mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 00:11:26 +00:00
Don't resurrect GSFileHandle singletons.
It seems to be no longer possible to call -retain from -dealloc with the latest libobjc2, which was causing the tests to fail. We are also throwing an exception in this case, which would need to be specifically caught in order for the resurrection to be of value to users, so this simply removes the -retain call and resets the singleton variables to nil in order to not have invalid pointers and for the singletons to be re-created on subsequent access.
This commit is contained in:
parent
c52f1e3223
commit
b05481a8c8
2 changed files with 3 additions and 9 deletions
|
@ -351,19 +351,19 @@ static GSTcpTune *tune = nil;
|
|||
{
|
||||
if (self == fh_stdin)
|
||||
{
|
||||
RETAIN(self);
|
||||
fh_stdin = nil;
|
||||
[NSException raise: NSGenericException
|
||||
format: @"Attempt to deallocate standard input handle"];
|
||||
}
|
||||
if (self == fh_stdout)
|
||||
{
|
||||
RETAIN(self);
|
||||
fh_stdout = nil;
|
||||
[NSException raise: NSGenericException
|
||||
format: @"Attempt to deallocate standard output handle"];
|
||||
}
|
||||
if (self == fh_stderr)
|
||||
{
|
||||
RETAIN(self);
|
||||
fh_stderr = nil;
|
||||
[NSException raise: NSGenericException
|
||||
format: @"Attempt to deallocate standard error handle"];
|
||||
}
|
||||
|
|
|
@ -15,15 +15,9 @@ int main(void)
|
|||
b = [NSFileHandle fileHandleWithStandardOutput];
|
||||
c = [NSFileHandle fileHandleWithStandardError];
|
||||
END_SET("handle creation")
|
||||
PASS([a retainCount]> 0, "stdin persists");
|
||||
PASS([b retainCount]> 0, "stdout persists");
|
||||
PASS([c retainCount]> 0, "strerr persists");
|
||||
PASS_EXCEPTION([a release], NSGenericException, "Cannot dealloc stdin");
|
||||
PASS_EXCEPTION([b release], NSGenericException, "Cannot dealloc stdout");
|
||||
PASS_EXCEPTION([c release], NSGenericException, "Cannot dealloc stderr");
|
||||
PASS([a retainCount]> 0, "stdin persists");
|
||||
PASS([b retainCount]> 0, "stdout persists");
|
||||
PASS([c retainCount]> 0, "strerr persists");
|
||||
|
||||
[p drain];
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue