From 5611d53c8c5ecf586233636d6090ce7e47644e04 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Thu, 21 Feb 2013 21:49:19 +0100 Subject: fixed global object initialization order issue * Scintilla is now initialized from main() using Interface::main() * Scintilla initialization depends on initialization of objects in the global namespace (otherwise the Lexer catalogue may not be filled properly and lexing may not work). Lexer modules were initialized after SciTECO interface initialization * merged Scintilla initialization (Interface::main()) with interface option parsing --- src/interface-ncurses.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'src/interface-ncurses.cpp') diff --git a/src/interface-ncurses.cpp b/src/interface-ncurses.cpp index a0e1e9a..3458813 100644 --- a/src/interface-ncurses.cpp +++ b/src/interface-ncurses.cpp @@ -52,7 +52,9 @@ static void scintilla_notify(Scintilla *sci, int idFrom, #define SCI_COLOR_ATTR(f, b) \ COLOR_PAIR(SCI_COLOR_PAIR(f, b)) -InterfaceNCurses::InterfaceNCurses() +void +InterfaceNCurses::main(int &argc __attribute__((unused)), + char **&argv __attribute__((unused))) { init_screen(); cbreak(); @@ -442,18 +444,23 @@ InterfaceNCurses::Popup::~Popup() InterfaceNCurses::~InterfaceNCurses() { - delwin(info_window); + if (info_window) + delwin(info_window); g_free(info_current); /* also deletes curses window */ - scintilla_delete(sci); - delwin(cmdline_window); + if (sci) + scintilla_delete(sci); + if (cmdline_window) + delwin(cmdline_window); g_free(cmdline_current); - delwin(msg_window); + if (msg_window) + delwin(msg_window); if (!isendwin()) endwin(); - delscreen(screen); + if (screen) + delscreen(screen); if (screen_tty) fclose(screen_tty); } -- cgit v1.2.3