| 458 if (irc->cancellable != NULL) { |
459 if (irc->cancellable != NULL) { |
| 459 g_cancellable_cancel(irc->cancellable); |
460 g_cancellable_cancel(irc->cancellable); |
| 460 g_clear_object(&irc->cancellable); |
461 g_clear_object(&irc->cancellable); |
| 461 } |
462 } |
| 462 |
463 |
| |
464 if (irc->conn != NULL) { |
| |
465 purple_gio_graceful_close(G_IO_STREAM(irc->conn), |
| |
466 G_INPUT_STREAM(irc->input), |
| |
467 G_OUTPUT_STREAM(irc->output)); |
| |
468 } |
| |
469 |
| 463 g_clear_object(&irc->input); |
470 g_clear_object(&irc->input); |
| 464 g_clear_object(&irc->output); |
471 g_clear_object(&irc->output); |
| 465 |
472 g_clear_object(&irc->conn); |
| 466 if (irc->conn != NULL) { |
473 |
| 467 GError *error = NULL; |
|
| 468 |
|
| 469 if (!g_io_stream_close(G_IO_STREAM(irc->conn), NULL, &error)) { |
|
| 470 purple_debug_warning("irc", |
|
| 471 "Error closing connection: %s", |
|
| 472 error->message); |
|
| 473 g_clear_error(&error); |
|
| 474 } |
|
| 475 |
|
| 476 g_clear_object(&irc->conn); |
|
| 477 } |
|
| 478 if (irc->timer) |
474 if (irc->timer) |
| 479 purple_timeout_remove(irc->timer); |
475 purple_timeout_remove(irc->timer); |
| 480 g_hash_table_destroy(irc->cmds); |
476 g_hash_table_destroy(irc->cmds); |
| 481 g_hash_table_destroy(irc->msgs); |
477 g_hash_table_destroy(irc->msgs); |
| 482 g_hash_table_destroy(irc->buddies); |
478 g_hash_table_destroy(irc->buddies); |