1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-06-29 13:17:46 +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

@ -69,7 +69,8 @@ const char glob_cmd_list[AC_NUM_GLOB_COMMANDS][MAX_CMDNAME_SIZE] = {
#endif /* _SUPPORT_AUDIO */
};
void kill_prompt_window(ToxWindow *self) {
void kill_prompt_window(ToxWindow *self)
{
ChatContext *ctx = self->chatwin;
StatusBar *statusbar = self->stb;

View File

@ -321,7 +321,7 @@ int init_connection(Tox *m)
return 4;
}
#define TRY_CONNECT 10
#define TRY_CONNECT 10 /* Seconds between connection attempts when DHT is not connected */
static void do_connection(Tox *m, ToxWindow *prompt)
{

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);
}