From 2542eb02648294256a01ae4ecb6ac81bc8ab5094 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Sun, 16 Nov 2014 23:46:08 +0100 Subject: Make sure QRegister::view is properly initialized and cleaned up * it must be initialized after the UI (Interface::main), so I added a View::initialize() function * the old initialize() method was renamed to setup() * use a global instance of QRegister::view so it is guaranteed to be destroyed only after any QRegisters that could still need it * Document API adapted to work with ViewCurrent references --- src/interface-ncurses.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/interface-ncurses.h') diff --git a/src/interface-ncurses.h b/src/interface-ncurses.h index d245e86..53b6b3e 100644 --- a/src/interface-ncurses.h +++ b/src/interface-ncurses.h @@ -35,8 +35,18 @@ typedef class ViewNCurses : public View { Scintilla *sci; public: - ViewNCurses(); - ~ViewNCurses(); + ViewNCurses() : sci(NULL) {} + + /* implementation of View::initialize() */ + void initialize_impl(void); + + inline ~ViewNCurses() + { + if (sci) { + delwin(get_window()); + scintilla_delete(sci); + } + } inline void refresh(void) -- cgit v1.2.3