AmendHub

Download:

jcs

/

wallops

/

amendments

/

87

chatter: Change order of operations in close_tab


jcs made amendment 87 about 1 month ago
--- chatter.c Wed Sep 11 10:33:39 2024 +++ chatter.c Wed Sep 11 16:33:31 2024 @@ -1294,11 +1294,15 @@ void chatter_close_tab(struct chatter *chatter, struct chatter_tab *tab) { struct chatter_tab *ttab = NULL, *next_tab = NULL; + struct irc_channel *channel = NULL; short n; if (!tab) return; + if (tab->channel) + channel = tab->channel; + SLIST_FOREACH(ttab, &chatter->tabs_list, list) { if (ttab->conn != tab->conn) continue; @@ -1319,16 +1323,17 @@ chatter_close_tab(struct chatter *chatter, struct chat if (chatter->current_tab == tab) chatter->current_tab = NULL; + xfree(&tab); + + if (channel) + irc_part_channel(tab->conn, channel); + if (next_tab == NULL) chatter_draw_tab_bar(chatter); else chatter_focus_tab(chatter, next_tab); chatter_reveal_shadow(chatter); - - if (tab->channel) - irc_part_channel(tab->conn, tab->channel); - chatter_update_menu(chatter->focusable); }