Hi Paulo, On 04/12/2013 03:41 PM, Paulo Borges wrote: > When a RequestDisconnect() is received, the emulator must be both > disconnected and removed from the hash. > > But an emulator can also be disconnected and freed automatically if its > GAtServer closes. In this case, the hash can hold an invalid pointer. > > So, after the emulator is registered, a function is set to be called > when the emulator is about to be freed and this function removes the > emulator from the hash. > --- > plugins/hfp_ag_bluez5.c | 43 +++++++++++++++++++++++++++++++++++++++---- > 1 file changed, 39 insertions(+), 4 deletions(-) Have you considered keeping track of the file descriptors instead? e.g. simply adding a hash table of fds obtained from NewConnection() and g_io_add_watch()-ing on the 'HUP' condition? Regards, -Denis