AmendHub

Download:

jcs

/

wallops

/

amendments

/

132

irc: Fix bug in reconnection

We need to move each channel to the new connection and reset its
channel_list before deallocating it, since the existing tabs are
tied to those and will be reused when we rejoin.

jcs made amendment 132 about 1 year ago
--- irc.c Mon Sep 23 15:41:48 2024 +++ irc.c Tue Sep 24 17:00:08 2024 @@ -1196,10 +1196,17 @@ irc_process_input(struct irc_connection *conn, struct if (tab->conn == conn) tab->conn = new; } + + /* move channels to new connection */ + SLIST_FOREACH(channel, &conn->channels_list, list) + channel->connection = new; + + /* otherwise irc_dealloc_connection will take them out */ + SLIST_INIT(&conn->channels_list); irc_dealloc_connection(conn); - conn->chatter->need_tab_bar_redraw = true; + new->chatter->need_tab_bar_redraw = true; } else { /* just keep the old one */ irc_dealloc_connection(new);