diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2013-02-21 21:49:19 +0100 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2013-02-22 01:18:06 +0100 |
commit | 5611d53c8c5ecf586233636d6090ce7e47644e04 (patch) | |
tree | 3e14daa1cb71778d5f54a3714eaba32fdc226eae /src/interface-gtk.cpp | |
parent | 8f0e72f0fedbfc8e4f26bff93472d0c1d59247df (diff) | |
download | sciteco-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-gtk.cpp')
-rw-r--r-- | src/interface-gtk.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
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(); } |