From: Evan S. <ev...@ad...> - 2006-09-26 15:14:16
|
On Sep 26, 2006, at 10:53 AM, Eduardo P=E9rez wrote: > I think using a GSList of GaimProxyConnectData is a bad idea. > I do not see why you need to keep a list of GaimProxyConnectData. > > Could you describe the problem (crash)? > 1) yahoo_buddy_icon_upload() is called. This calls gaim_proxy_connect=20 () to begin a connection process; yahoo_buddy_icon_upload_connected() =20= is the callback to be triggered when the connection is complete 2) The account is disconnected. 3) gaim_proxy_connect() finishes the connection. It calls =20 yahoo_buddy_icon_upload_connected(), passing it back the =20 yahoo_buddy_icon_upload_data struct associated with the original =20 gaim_proxy_connect() call. This struct has been free()'d because the =20 account was disconnected. (Additionally, if it hadn't been, it would =20 have a pointer to a GaimConnection which has now been freed). 4) Crash This problem exists within Gaim anywhere that the connect attempt is =20 not guaranteed to return immediately and is not cancelled when the =20 account disconnects. The GaimProxyConnectData struct is necessary to cancel the connection =20= attempt via the proxy.c API. Therefore, when the Yahoo account disconnects, it needs to cancel all =20= attempts it initiated. To do so it needs to keep track of them; =20 hence, the GSList. Better, though, looking it in that way, would be to have proxy.c keep =20= track of handles for accounts, as the request and notify APIs do, and =20= automatically cancel all pending requests when the account =20 disconnects. Mark, what do you think about that? > I was looking the other day to this web page: > http://www.artima.com/weblogs/viewpost.jsp?thread=3D168511 > and saw this inside yahoo_buddy_icon_upload_connected(): > if (!d) > return; > That seems like bad code. Indeed. -Evan= |