Re: class referencing and type implementation mutations (Re: Audit module)



Tim Janik <timj gtk org> writes:

> On 23 Jun 2001, Havoc Pennington wrote:
> 
> > 
> > Hi,
> > 
> > My remaining question on this is why a static class gets unloaded ever
> > at all - I would expect get_type() to result in making that class
> > permanently resident. I think we have code in GTK even that assumes
> 
> not get_type, but yes, static classes stay initialized after the first class_init.
> 
> > class_init will run only one time. I know Darin was also worried about
> > this behavior since Nautilus has similar assumptions. Obviously
> > dynamic classes would be different in this respect.
> > 
> > Regardless of that issue, why not put in a warning in
> > g_signal_lookup() etc., if the class is not registered - the silent
> > return of 0 is extremely hard to figure out, and calling
> > g_signal_lookup() on an unregistered class seems like it's always a
> > bug.
> 
> iirc, the lookup code doesn't make actual destinctions between
> a) valid type ids with an initialized class that has no signals
> b) valid type ids who's classes haven't been initialized yet
> c) invalid type ids
> 
> and at least for (a) it should return 0 silently.

Sounds like it needs to make that distinction ;-). Since we
don't care much about speed on the failure path, we can
do:

 - Look up signal
 - If that fails, warn if the type id is not loaded or is invalid.

Regards,
                                        Owen
 




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]