Re: bug in signal lookup?



Paolo Molaro <lupus@lettere.unipd.it> writes:

> Is it a bug or a feature? To me it looks like a bug.

Looks like a bug to me, too.

> The following program outputs "signal not found" when you comment
> out the dummy gtk_label_new().  Signal creation is done the first
> time an object is created and there is no way to force that without
> creating an object.

Would gtk_type_class work?

Anyway, I think gtk_signal_lookup should make sure that the type has
been completely created.  It could call gtk_type_class (or some
specialized type initialization function) unconditionally but that
might have unacceptable overhead in the usual case that the type
already is initialized.  Alternatively, the type initialization could
be done only when the signal lookup fails, and tthen gtk_signal_lookup
would try again.  This would shift the overhead to the `unusual' case.

> Initializing signals in the type_unique or type_create function
> could be done, but I guess that is expensive.

It is expensive but we only need to do it once.  When you want to work
with the type, it must be initialized.  Looking for a signal of a type
qualifies as working with the type to me, so gtk_signal_lookup should
ideally do the initialization.  gtk_args_query behaves that way, for
example.

> There are two solutions to this: have an hook for type generation
> (that can be of some use to interpreted languages also)

I can't think of a use for that, but it doesn't hurt to have,
either...

- Marius



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