Hi Niels,

Le 18 juin 09 à 14:18, Niels Grewe a écrit :

> Hello again,
>
> I just stumbled upon a little bug in ETGetSuperclass() (from
> NSObject+Etoile.m). If you were trying to resolve the superclass of a
> root class, objc_lookup_class() would be called with NULL as an
> argument, resulting in a crash. In the attached patch this is fixed  
> for
> the GNU runtime. I'm not sure if other runtimes need similar  
> treatment.

The patch looks good to me.

However what I would like to do is to move ETGetSuperclass GNU runtime  
related implementation (including your patch) into the ObjC 2  
framework recently written by David. Then we could link  
EtoileFoundation to it and get rid of ETGetSuperclass(). To support  
Apple ObjC 2 API and GNU ObjC API is enough I think, we don't really  
care about supporting the old NeXT runtime API.

class_getSuperclass() currently simply calls the GNU runtime  
class_get_superclass() which is a weird API. I don't really understand  
why it exists when you consider its behavior, it just seems to have no  
real use. That's why ETGetSuperclass() was created in fact. iirc  
class_get_superclass() fails in two cases:
- if you pass a metaclass
- if the class hasn't been yet resolved

Thanks,
Quentin.
_______________________________________________
Etoile-dev mailing list
[email protected]
https://mail.gna.org/listinfo/etoile-dev

Reply via email to