1
0
mirror of https://github.com/Tha14/toxic.git synced 2025-07-01 06:26:44 +02:00

delete subwindows before parent window on resize to prevent memory leaks

This commit is contained in:
Jfreegman
2014-07-09 22:11:31 -04:00
parent a774121c13
commit e19b0ed710
3 changed files with 10 additions and 7 deletions

View File

@ -326,11 +326,11 @@ void on_window_resize(void)
ToxWindow *w = &windows[i];
delwin(w->window);
w->window = newwin(y2, x2, 0, 0);
if (windows[i].is_friendlist)
if (windows[i].is_friendlist) {
delwin(w->window);
w->window = newwin(y2, x2, 0, 0);
continue;
}
if (w->help->active)
wclear(w->help->win);
@ -342,7 +342,9 @@ void on_window_resize(void)
delwin(w->chatwin->linewin);
delwin(w->chatwin->history);
delwin(w->window);
w->window = newwin(y2, x2, 0, 0);
w->chatwin->linewin = subwin(w->window, CHATBOX_HEIGHT, x2, y2 - CHATBOX_HEIGHT, 0);
if (w->is_groupchat) {
@ -358,7 +360,7 @@ void on_window_resize(void)
delwin(w->chatwin->infobox.win);
w->chatwin->infobox.win = newwin(INFOBOX_HEIGHT, INFOBOX_WIDTH + 1, 1, x2 - INFOBOX_WIDTH);
}
#endif /* _SUPPORT_AUDIO */
#endif /* _SUPPORT_AUDIO */
scrollok(w->chatwin->history, 0);
}