comparison libgaim/protocols/oscar/flap_connection.c @ 15355:00d0d4524377

[gaim-migrate @ 18148] Some safety which should avoid a post-disconnect crash I've seen reported committer: Tailor Script <tailor@pidgin.im>
author Evan Schoenberg <evan.s@dreskin.net>
date Wed, 17 Jan 2007 15:07:07 +0000
parents 4934e7a03a98
children
comparison
equal deleted inserted replaced
15354:db11d9e416ac 15355:00d0d4524377
357 OscarData *od; 357 OscarData *od;
358 GaimAccount *account; 358 GaimAccount *account;
359 359
360 conn = data; 360 conn = data;
361 od = conn->od; 361 od = conn->od;
362 account = gaim_connection_get_account(od->gc); 362 account = (GAIM_CONNECTION_IS_VALID(od->gc) ? gaim_connection_get_account(od->gc) : NULL);
363 363
364 gaim_debug_info("oscar", "Destroying oscar connection of " 364 gaim_debug_info("oscar", "Destroying oscar connection of "
365 "type 0x%04hx\n", conn->type); 365 "type 0x%04hx\n", conn->type);
366 366
367 od->oscar_connections = g_slist_remove(od->oscar_connections, conn); 367 od->oscar_connections = g_slist_remove(od->oscar_connections, conn);
368 368
369 /* 369 /*
370 * TODO: If we don't have a SNAC_FAMILY_LOCATE connection then 370 * TODO: If we don't have a SNAC_FAMILY_LOCATE connection then
371 * we should try to request one instead of disconnecting. 371 * we should try to request one instead of disconnecting.
372 */ 372 */
373 if (!account->disconnecting && ((od->oscar_connections == NULL) 373 if (account && !account->disconnecting &&
374 || (!flap_connection_getbytype(od, SNAC_FAMILY_LOCATE)))) 374 ((od->oscar_connections == NULL) || (!flap_connection_getbytype(od, SNAC_FAMILY_LOCATE))))
375 { 375 {
376 /* No more FLAP connections! Sign off this GaimConnection! */ 376 /* No more FLAP connections! Sign off this GaimConnection! */
377 gchar *tmp; 377 gchar *tmp;
378 if (conn->disconnect_reason == OSCAR_DISCONNECT_REMOTE_CLOSED) 378 if (conn->disconnect_reason == OSCAR_DISCONNECT_REMOTE_CLOSED)
379 tmp = g_strdup(_("Server closed the connection.")); 379 tmp = g_strdup(_("Server closed the connection."));