Mercurial > pidgin
diff src/protocols/oscar/oscar.c @ 8978:8e69a730885c
[gaim-migrate @ 9752]
This fixes a bug whereby an oscar_direct_im could get destroyed, and then
gaim_proxy_connect would call its callback and we'd try to dereference it.
Als some small whitespace changes that my editor made for me.
committer: Tailor Script <tailor@pidgin.im>
author | Tim Ringenbach <marv@pidgin.im> |
---|---|
date | Wed, 19 May 2004 04:43:16 +0000 |
parents | f831a38eb6ba |
children | 382bbf503c3d |
line wrap: on
line diff
--- a/src/protocols/oscar/oscar.c Wed May 19 04:41:01 2004 +0000 +++ b/src/protocols/oscar/oscar.c Wed May 19 04:43:16 2004 +0000 @@ -141,6 +141,8 @@ int watcher; aim_conn_t *conn; gboolean connected; + gboolean gpc_pend; + gboolean killme; }; struct ask_direct { @@ -708,6 +710,10 @@ "destroying Direct IM for %s.\n", dim->name); od->direct_ims = g_slist_remove(od->direct_ims, dim); + if (dim->gpc_pend) { + dim->killme = TRUE; + return; + } if (dim->watcher) gaim_input_remove(dim->watcher); if (dim->conn) { @@ -728,7 +734,7 @@ if (dim->connected) g_snprintf(buf, sizeof buf, _("Direct IM with %s closed"), dim->name); - else + else g_snprintf(buf, sizeof buf, _("Direct IM with %s failed"), dim->name); conv = gaim_find_conversation_with_account(dim->name, gaim_connection_get_account(dim->gc)); @@ -777,6 +783,12 @@ g_return_if_fail(gc != NULL); + dim->gpc_pend = FALSE; + if (dim->killme) { + oscar_direct_im_destroy(od, dim); + return; + } + if (!g_list_find(gaim_connections_get_all(), gc)) { oscar_direct_im_destroy(od, dim); return; @@ -850,9 +862,11 @@ } host = g_strndup(d->ip, i); dim->conn->status |= AIM_CONN_STATUS_INPROGRESS; + dim->gpc_pend = TRUE; rc = gaim_proxy_connect(gc->account, host, port, oscar_odc_callback, dim); g_free(host); if (rc < 0) { + dim->gpc_pend = FALSE; oscar_direct_im_disconnect(od, dim); destroy_direct_im_request(d); return;