From: Evan S. <ev...@dr...> - 2006-09-26 21:04:06
|
On Sep 26, 2006, at 4:51 PM, Mark Huetsch wrote: > Hmm, my solution would be to add a pointer to gc to the > GaimProxyConnectData struct, initializing it appropriately in > gaim_proxy_connect(). Then we could check in > gaim_proxy_connect_data_connected() to ensure it hasn't been freed > before calling the callback. Something like: > > static void > gaim_proxy_connect_data_connected(GaimProxyConnectData *connect_data) > { > - connect_data->connect_cb(connect_data->data, connect_data- > >fd, NULL); > + if (g_list_find(gaim_connections_get_all(), connect_data->gc)) > + connect_data->connect_cb(connect_data->data, > connect_data->fd, NULL); > + else > + g_free(connect_data->data) The g_list_find() call there is the same as GAIM_CONNECTION_IS_VALID () (a #define in connection.h) and a desire for it to be unnecessary is part of why kingant started the cancellable connections in the first place... however, that's a really interesting thought -- using it in exactly one place doesn't seem so bad when that means that any connection which doesn't get cancelled for a disconnected account will complete its connect process and then silently go away. This would provide a level of failsafe, while all existing code should still be converted to cancel their gaim_proxy_connect() attempts on disconnect... kingant, what do you think? -Evan |