fix backscroll reconfig segv

SVN revision: 72384
This commit is contained in:
Carsten Haitzler 2012-06-18 11:18:46 +00:00
parent 464b2986ed
commit 4a071403a0
1 changed files with 5 additions and 1 deletions

View File

@ -44,6 +44,7 @@ _text_save_top(Termpty *ty)
{
Termsave *ts;
if (ty->backmax <= 0) return;
ts = malloc(sizeof(Termsave) + ((ty->w - 1) * sizeof(Termcell)));
ts->w = ty->w;
_text_copy(ty, ty->screen, ts->cell, ty->w);
@ -1608,7 +1609,10 @@ termpty_backscroll_set(Termpty *ty, int size)
}
free(ty->back);
}
ty->back = calloc(1, sizeof(Termsave *) * ty->backmax);
if (size > 0)
ty->back = calloc(1, sizeof(Termsave *) * size);
else
ty->back = NULL;
ty->backscroll_num = 0;
ty->backpos = 0;
ty->backmax = size;