From: Michael Göhler Date: Mon, 19 Jan 2015 20:37:58 +0000 (+0100) Subject: delwin() and dereferencing issue in viewer, #70 X-Git-Url: https://git.danieliu.xyz/?p=smdp.git;a=commitdiff_plain;h=96f4804a413b591d74505eacfa621604b56f6d5f delwin() and dereferencing issue in viewer, #70 --- diff --git a/src/viewer.c b/src/viewer.c index 0e2da58..50646d7 100644 --- a/src/viewer.c +++ b/src/viewer.c @@ -93,12 +93,12 @@ int ncurses_display(deck_t *deck, int notrans, int nofade, int invert) { lc = 0; line = slide->line; - while(line) { + while(line && line->text) { - if (line && line->text && line->text->text) + if (line->text->text) lc += url_count_inline(line->text->text); - if (line && line->text && line->text->text) + if (line->text->text) line->length -= url_len_inline(line->text->text); if(line->length > COLS) { @@ -415,8 +415,13 @@ int ncurses_display(deck_t *deck, int notrans, int nofade, int invert) { url_purge(); } + // disable ncurses endwin(); + // free ncurses memory + delwin(content); + delwin(stdscr); + return 0; }