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-gtk.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/interface-gtk.cpp') diff --git a/src/interface-gtk.cpp b/src/interface-gtk.cpp index d1d20cd..cc39699 100644 --- a/src/interface-gtk.cpp +++ b/src/interface-gtk.cpp @@ -53,12 +53,13 @@ static gboolean exit_app(GtkWidget *w, GdkEventAny *e, gpointer p); #define UNNAMED_FILE "(Unnamed)" -InterfaceGtk::InterfaceGtk() +void +InterfaceGtk::main(int &argc, char **&argv) { GtkWidget *vbox; GtkWidget *info_content; - gtk_init(NULL, NULL); + gtk_init(&argc, &argv); window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(window), PACKAGE_NAME); @@ -203,8 +204,10 @@ InterfaceGtk::widget_set_font(GtkWidget *widget, const gchar *font_name) InterfaceGtk::~InterfaceGtk() { - gtk_widget_destroy(popup_widget); - gtk_widget_destroy(window); + if (popup_widget) + gtk_widget_destroy(popup_widget); + if (window) + gtk_widget_destroy(window); scintilla_release_resources(); } -- cgit v1.2.3