Re: GLib Proposal: internal destroy func/data for GHook



David Helder <dhelder umich edu> writes:

> Problem:
> 
> I'm implementing an IOChannel.  When the user removes a watch, the
> appropriate hook gets destroyed, but I (the IOChannel implementor) have no
> good way of knowing this.  I want to know this so I can update my internal
> bookkeeping data (which the Win32 port of GNet needs).  I could set the
> destroy func and user data on the hook, but then it will break
> source_remove_by_user_data.  (It won't break the user's destroy callback
> in general because I can still call it in my destroy callback).
> 
> Or, is there something I'm missing?

Look at giounix.c - the function g_io_unix_destroy() is called when
the watch is removed. I'm not sure what else you want.
 
> Solution:
> 
> Add an internal_destroy_func and internal_destory_user_data to GHook.  
> IOChannel implementors may use it, g_source_add may not use it.  Call it
> in hook_destroy_link.  Drawbacks: larger GHook, slower hook_destroy_link.

These facilities are really already there.

                                        Owen




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