comparison src/connection.c @ 6013:9ab75d4fafac

[gaim-migrate @ 6461] This should fix any crashes or infinite loops when calling gaim_connection_error(), followed by gaim_connection_disconnect(). committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Fri, 04 Jul 2003 06:43:21 +0000
parents 0ca618645cec
children d4caf585f6ff
comparison
equal deleted inserted replaced
6012:4c16227f7cd9 6013:9ab75d4fafac
348 ops->notice(gc, text); 348 ops->notice(gc, text);
349 } 349 }
350 350
351 static gboolean disconnect_conn_cb(gpointer data) 351 static gboolean disconnect_conn_cb(gpointer data)
352 { 352 {
353 gaim_connection_disconnect(data); 353 GaimAccount *account = (GaimAccount *)data;
354 GaimConnection *gc;
355
356 gc = gaim_account_get_connection(account);
357
358 if (gc != NULL)
359 gaim_connection_disconnect(data);
360
354 return FALSE; 361 return FALSE;
355 } 362 }
356 363
357 void 364 void
358 gaim_connection_error(GaimConnection *gc, const char *text) 365 gaim_connection_error(GaimConnection *gc, const char *text)
365 ops = gaim_get_connection_ui_ops(); 372 ops = gaim_get_connection_ui_ops();
366 373
367 if (ops != NULL && ops->disconnected != NULL) 374 if (ops != NULL && ops->disconnected != NULL)
368 ops->disconnected(gc, text); 375 ops->disconnected(gc, text);
369 376
370 g_timeout_add(0, disconnect_conn_cb, gc); 377 g_timeout_add(0, disconnect_conn_cb, gaim_connection_get_account(gc));
371 } 378 }
372 379
373 void 380 void
374 gaim_connections_disconnect_all(void) 381 gaim_connections_disconnect_all(void)
375 { 382 {