aboutsummaryrefslogtreecommitdiffstats
path: root/src/term.c
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2016-05-10 16:03:37 -0400
committerJesse Luehrs <doy@tozt.net>2016-05-10 16:03:37 -0400
commit9118ead5ae15548c8a5b96340f9a0a24b3104e32 (patch)
tree5931f2b6e538cb369e97e2ccfa089615a7415e0a /src/term.c
parent082d730944950c202f24d3701878c06cf5e44f5f (diff)
downloadrunes-9118ead5ae15548c8a5b96340f9a0a24b3104e32.tar.gz
runes-9118ead5ae15548c8a5b96340f9a0a24b3104e32.zip
make terms handle cleaning themselves up
Diffstat (limited to 'src/term.c')
-rw-r--r--src/term.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/term.c b/src/term.c
index 0584653..fe79cc5 100644
--- a/src/term.c
+++ b/src/term.c
@@ -42,6 +42,20 @@ void runes_term_init(RunesTerm *t, RunesLoop *loop, int argc, char *argv[])
runes_term_init_loop(t, loop);
}
+void runes_term_refcnt_inc(RunesTerm *t)
+{
+ t->refcnt++;
+}
+
+void runes_term_refcnt_dec(RunesTerm *t)
+{
+ t->refcnt--;
+ if (t->refcnt <= 0) {
+ runes_term_cleanup(t);
+ free(t);
+ }
+}
+
void runes_term_set_window_size(RunesTerm *t, int xpixel, int ypixel)
{
int row = ypixel / t->display->fonty, col = xpixel / t->display->fontx;
@@ -55,12 +69,6 @@ void runes_term_cleanup(RunesTerm *t)
vt100_screen_cleanup(t->scr);
free(t->scr);
- runes_pty_backend_cleanup(t->pty);
- free(t->pty);
-
- runes_window_backend_cleanup(t->w);
- free(t->w);
-
runes_display_cleanup(t->display);
free(t->display);