1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-12-23 16:23:26 +01:00

possibly fix segfault

This commit is contained in:
Jfreegman 2014-07-01 14:55:59 -04:00
parent 893cfaa543
commit 7c71c35797

View File

@ -329,45 +329,41 @@ void on_window_resize(void)
continue;
}
ChatContext *ctx = w->chatwin;
if (w->is_groupchat)
delwin(ctx->sidebar);
else
delwin(w->stb->topline);
delwin(ctx->linewin);
delwin(ctx->history);
delwin(w->window);
w->window = newwin(LINES - 2, COLS, 0, 0);
int x2, y2, x, y;
getmaxyx(w->window, y2, x2);
getyx(w->window, y, x); /* don't remove this */
w->x = x2;
ctx = w->chatwin;
ctx->linewin = subwin(w->window, CHATBOX_HEIGHT, x2, y2 - CHATBOX_HEIGHT, 0);
if (w->is_groupchat)
delwin(w->chatwin->sidebar);
else
delwin(w->stb->topline);
delwin(w->chatwin->linewin);
delwin(w->chatwin->history);
w->chatwin->linewin = subwin(w->window, CHATBOX_HEIGHT, x2, y2 - CHATBOX_HEIGHT, 0);
if (w->is_groupchat) {
ctx->history = subwin(w->window, y2 - CHATBOX_HEIGHT + 1, x2 - SIDEBAR_WIDTH - 1, 0, 0);
ctx->sidebar = subwin(w->window, y2 - CHATBOX_HEIGHT + 1, SIDEBAR_WIDTH, 0, x2 - SIDEBAR_WIDTH);
w->chatwin->history = subwin(w->window, y2 - CHATBOX_HEIGHT + 1, x2 - SIDEBAR_WIDTH - 1, 0, 0);
w->chatwin->sidebar = subwin(w->window, y2 - CHATBOX_HEIGHT + 1, SIDEBAR_WIDTH, 0, x2 - SIDEBAR_WIDTH);
} else {
ctx->history = subwin(w->window, y2 - CHATBOX_HEIGHT + 1, x2, 0, 0);
w->chatwin->history = subwin(w->window, y2 - CHATBOX_HEIGHT + 1, x2, 0, 0);
w->stb->topline = subwin(w->window, 2, x2, 0, 0);
}
#ifdef _SUPPORT_AUDIO
if (ctx->infobox.active) {
delwin(ctx->infobox.win);
ctx->infobox.win = newwin(INFOBOX_HEIGHT, INFOBOX_WIDTH + 1, 1, x2 - INFOBOX_WIDTH);
if (w->chatwin->infobox.active) {
delwin(w->chatwin->infobox.win);
w->chatwin->infobox.win = newwin(INFOBOX_HEIGHT, INFOBOX_WIDTH + 1, 1, x2 - INFOBOX_WIDTH);
}
#endif /* #ifdef _SUPPORT_AUDIO */
scrollok(ctx->history, 0);
scrollok(w->chatwin->history, 0);
}
}