Destroy screens properly.

pull/1/head
Nicholas Marriott 2007-10-01 14:15:48 +00:00
parent 532757fd1c
commit 9d563c340b
3 changed files with 16 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $Id: screen.c,v 1.17 2007-09-29 18:57:15 nicm Exp $ */
/* $Id: screen.c,v 1.18 2007-10-01 14:15:48 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -157,6 +157,16 @@ screen_resize(struct screen *s, u_int sx, u_int sy)
}
}
/* Destroy a screen. */
void
screen_destroy(struct screen *s)
{
screen_free_lines(s, 0, s->sy);
xfree(s->grid_data);
xfree(s->grid_attr);
xfree(s->grid_colr);
}
/* Draw a set of lines on the screen. */
void
screen_draw(struct screen *s, struct buffer *b, u_int uy, u_int ly)

3
tmux.h
View File

@ -1,4 +1,4 @@
/* $Id: tmux.h,v 1.28 2007-09-30 13:02:14 nicm Exp $ */
/* $Id: tmux.h,v 1.29 2007-10-01 14:15:48 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -565,6 +565,7 @@ void input_translate_key(struct buffer *, int);
/* screen.c */
void screen_create(struct screen *, u_int, u_int);
void screen_destroy(struct screen *);
void screen_resize(struct screen *, u_int, u_int);
void screen_draw(struct screen *, struct buffer *, u_int, u_int);
size_t screen_store_attributes(struct buffer *, u_char);

View File

@ -1,4 +1,4 @@
/* $Id: window.c,v 1.14 2007-09-29 14:25:49 nicm Exp $ */
/* $Id: window.c,v 1.15 2007-10-01 14:15:48 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -178,6 +178,8 @@ window_destroy(struct window *w)
input_free(&w->ictx);
screen_destroy(&w->screen);
buffer_destroy(w->in);
buffer_destroy(w->out);
xfree(w);