aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/interface-ncurses.cpp
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2013-02-21 21:49:19 +0100
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2013-02-22 01:18:06 +0100
commit5611d53c8c5ecf586233636d6090ce7e47644e04 (patch)
tree3e14daa1cb71778d5f54a3714eaba32fdc226eae /src/interface-ncurses.cpp
parent8f0e72f0fedbfc8e4f26bff93472d0c1d59247df (diff)
downloadsciteco-5611d53c8c5ecf586233636d6090ce7e47644e04.tar.gz
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
Diffstat (limited to 'src/interface-ncurses.cpp')
-rw-r--r--src/interface-ncurses.cpp19
1 files changed, 13 insertions, 6 deletions
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);
}