1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-30 05:03:26 +01: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 */ #endif /* _SUPPORT_AUDIO */
}; };
void kill_prompt_window(ToxWindow *self) { void kill_prompt_window(ToxWindow *self)
{
ChatContext *ctx = self->chatwin; ChatContext *ctx = self->chatwin;
StatusBar *statusbar = self->stb; StatusBar *statusbar = self->stb;

View File

@ -321,7 +321,7 @@ int init_connection(Tox *m)
return 4; 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) static void do_connection(Tox *m, ToxWindow *prompt)
{ {

View File

@ -326,11 +326,11 @@ void on_window_resize(void)
ToxWindow *w = &windows[i]; ToxWindow *w = &windows[i];
if (windows[i].is_friendlist) {
delwin(w->window); delwin(w->window);
w->window = newwin(y2, x2, 0, 0); w->window = newwin(y2, x2, 0, 0);
if (windows[i].is_friendlist)
continue; continue;
}
if (w->help->active) if (w->help->active)
wclear(w->help->win); wclear(w->help->win);
@ -342,7 +342,9 @@ void on_window_resize(void)
delwin(w->chatwin->linewin); delwin(w->chatwin->linewin);
delwin(w->chatwin->history); 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); w->chatwin->linewin = subwin(w->window, CHATBOX_HEIGHT, x2, y2 - CHATBOX_HEIGHT, 0);
if (w->is_groupchat) { if (w->is_groupchat) {