Mercurial > hg > nnchat
comparison nnchat.c @ 155:0720ca51673e
Plug some minor "memory leaks" related to curses.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 03 Nov 2010 01:33:39 +0200 |
parents | e8f67e344aaf |
children | 0a9fe14882dc |
comparison
equal
deleted
inserted
replaced
154:e8f67e344aaf | 155:0720ca51673e |
---|---|
671 th_free(tmpStr); | 671 th_free(tmpStr); |
672 | 672 |
673 return result ? 0 : -1; | 673 return result ? 0 : -1; |
674 } | 674 } |
675 | 675 |
676 | 676 void closeWindows(void) |
677 BOOL initializeWindows(void) | 677 { |
678 { | |
679 int w, h; | |
680 | |
681 getmaxyx(stdscr, h, w); | |
682 | |
683 if (mainWin) delwin(mainWin); | 678 if (mainWin) delwin(mainWin); |
684 if (statusWin) delwin(statusWin); | 679 if (statusWin) delwin(statusWin); |
685 if (editWin) delwin(editWin); | 680 if (editWin) delwin(editWin); |
681 } | |
682 | |
683 BOOL initializeWindows(void) | |
684 { | |
685 int w, h; | |
686 | |
687 getmaxyx(stdscr, h, w); | |
688 | |
689 closeWindows(); | |
686 | 690 |
687 mainWin = newwin(h - 4, w, 0, 0); | 691 mainWin = newwin(h - 4, w, 0, 0); |
688 statusWin = newwin(1, w, h - 4, 0); | 692 statusWin = newwin(1, w, h - 4, 0); |
689 editWin = newwin(3, w, h - 3, 0); | 693 editWin = newwin(3, w, h - 3, 0); |
690 | 694 |
1273 nn_editbuf_free(histBuf[histPos]); | 1277 nn_editbuf_free(histBuf[histPos]); |
1274 | 1278 |
1275 if (cursesInit) { | 1279 if (cursesInit) { |
1276 if (curVis != ERR) | 1280 if (curVis != ERR) |
1277 curs_set(curVis); | 1281 curs_set(curVis); |
1282 closeWindows(); | |
1278 endwin(); | 1283 endwin(); |
1279 THMSG(1, "NCurses deinitialized.\n"); | 1284 THMSG(1, "NCurses deinitialized.\n"); |
1280 } | 1285 } |
1281 | 1286 |
1282 if (isError) { | 1287 if (isError) { |