Re: DestroyNotify for Bonobo callbacks



>> There doesn't seem to be any DestroyNotify handling for Bonobo menu and
>> toolbar callbacks, making it very difficult to pass any callback data
>> that needs freeing. Am I missing something, or is this a hole in the
>> API? Is there any reason why such a feature shouldn't be added to
>> Bonobo? Darin has volunteered to add such a feature unless there's some
>> sensible reason not to.
> 
> Can the regular gtk_signal_connect on "destroy" be used for this?

No.

The menu and toolbar callback user data pointers are not GtkObject pointers,
just raw data pointers. See all calls that take BonoboUIHandlerCallbackFunc
pointers.

The simplest change I can think of is to change the set_callback and
get_callback functions to take destroy notify functions just as
gtk_object_set_data_full and gtk_signal_connect_full do. The alternative of
requiring that the callback data be a GtkObject would be much less
convenient.

Thus you have to do an explicit set_callback call if you have interesting
data that needs a destroy. But most clients won't need the destroy function
and won't call set_callback or get_callback so won't be affected by this
change.

(By the way, I suggest that the function type be renamed
BonoboUIHandlerCallback also.)

    -- Darin





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