summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/channels.c5
-rw-r--r--src/core/servers.c5
2 files changed, 6 insertions, 4 deletions
diff --git a/src/core/channels.c b/src/core/channels.c
index 5dd90c2e..9a92b896 100644
--- a/src/core/channels.c
+++ b/src/core/channels.c
@@ -77,8 +77,9 @@ void channel_destroy(CHANNEL_REC *channel)
channel->destroying = TRUE;
channels = g_slist_remove(channels, channel);
- if (!channel->server->disconnected)
- channel->server->channels = g_slist_remove(channel->server->channels, channel);
+ channel->server->channels =
+ g_slist_remove(channel->server->channels, channel);
+
signal_emit("channel destroyed", 1, channel);
MODULE_DATA_DEINIT(channel);
diff --git a/src/core/servers.c b/src/core/servers.c
index 4828750b..4f5b0402 100644
--- a/src/core/servers.c
+++ b/src/core/servers.c
@@ -361,15 +361,16 @@ int server_start_connect(SERVER_REC *server)
static int server_remove_channels(SERVER_REC *server)
{
- GSList *tmp;
+ GSList *tmp, *next;
int found;
g_return_val_if_fail(server != NULL, FALSE);
found = FALSE;
- for (tmp = server->channels; tmp != NULL; tmp = tmp->next) {
+ for (tmp = server->channels; tmp != NULL; tmp = next) {
CHANNEL_REC *channel = tmp->data;
+ next = tmp->next;
channel_destroy(channel);
found = TRUE;
}