1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-07-03 15:57:46 +02: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; 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); delwin(w->window);
w->window = newwin(LINES - 2, COLS, 0, 0); w->window = newwin(LINES - 2, COLS, 0, 0);
int x2, y2, x, y; int x2, y2, x, y;
getmaxyx(w->window, y2, x2); getmaxyx(w->window, y2, x2);
getyx(w->window, y, x); /* don't remove this */
w->x = x2; w->x = x2;
ctx = w->chatwin; if (w->is_groupchat)
ctx->linewin = subwin(w->window, CHATBOX_HEIGHT, x2, y2 - CHATBOX_HEIGHT, 0); 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) { if (w->is_groupchat) {
ctx->history = subwin(w->window, y2 - CHATBOX_HEIGHT + 1, x2 - SIDEBAR_WIDTH - 1, 0, 0); w->chatwin->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->sidebar = subwin(w->window, y2 - CHATBOX_HEIGHT + 1, SIDEBAR_WIDTH, 0, x2 - SIDEBAR_WIDTH);
} else { } 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); w->stb->topline = subwin(w->window, 2, x2, 0, 0);
} }
#ifdef _SUPPORT_AUDIO #ifdef _SUPPORT_AUDIO
if (ctx->infobox.active) { if (w->chatwin->infobox.active) {
delwin(ctx->infobox.win); delwin(w->chatwin->infobox.win);
ctx->infobox.win = newwin(INFOBOX_HEIGHT, INFOBOX_WIDTH + 1, 1, x2 - INFOBOX_WIDTH); w->chatwin->infobox.win = newwin(INFOBOX_HEIGHT, INFOBOX_WIDTH + 1, 1, x2 - INFOBOX_WIDTH);
} }
#endif /* #ifdef _SUPPORT_AUDIO */ #endif /* #ifdef _SUPPORT_AUDIO */
scrollok(ctx->history, 0); scrollok(w->chatwin->history, 0);
} }
} }