>Number:         1834
>Category:       gnustep
>Synopsis:       +alloc method on NSFileHandle isn't quite right
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    fedor
>State:          open
>Class:          sw-bug
>Submitter-Id:   unknown
>Arrival-Date:   Fri Jul 28 20:20:01 EDT 2000
>Last-Modified:
>Originator:     [EMAIL PROTECTED]
>Organization:
net
>Release:        Current CVS
>Environment:
RedHat 5.x
>Description:

The +alloc method on NSFileHandle isn't quite correct. Basically, it will
always create a NSFileHandle_concrete_class (UnixFileHandle), which is fine
until your create a subclass of NSFileHandle, which I have. Thus, NSFileHandle
needs to check and see if it's the actual NSFileHandle class or a subclass,
and it should only create an instance of NSFileHandle_concrete_class if it's
a NSFileHandle.

Here's some fixed code:

+ (Class)_concreteClass
{
  // AJR 2000-07-28 This method should only return NSFileHandle_concrete_class
  // when it's being called via NSFileHandle, otherwise we always return the
  // "concrete" class, and not an appropiate subclass.
  if ([self class] == [NSFileHandle class])
    {
      return NSFileHandle_concrete_class;
    }
    else
    {
      return [self class];
    }
}
>How-To-Repeat:
Create a subclass of of NSFileHandle, send a method that your subclass responds
to, but NSFileHandle doesn't, and you'll get an exception.
%0
>Fix:
>Audit-Trail:
>Unformatted:

Reply via email to