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/main.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index a713964..5697063 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -53,6 +53,7 @@ namespace SciTECO { * GCC init_priority() attribute */ InterfaceCurrent interface; +ViewCurrent QRegisters::view; /* * Scintilla will be initialized after these @@ -288,10 +289,9 @@ main(int argc, char **argv) /* * QRegister view must be initialized only now - * (after Curses initialization) + * (e.g. after Curses/GTK initialization). */ - QRegisters::view = new ViewCurrent(); - // FIXME: view should be deallocated */ + QRegisters::view.initialize(); /* search string and status register */ QRegisters::globals.insert("_"); -- cgit v1.2.3