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/interface-gtk.cpp | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'src/interface-gtk.cpp') diff --git a/src/interface-gtk.cpp b/src/interface-gtk.cpp index ed5a8c9..3421d6f 100644 --- a/src/interface-gtk.cpp +++ b/src/interface-gtk.cpp @@ -53,7 +53,8 @@ static gboolean exit_app(GtkWidget *w, GdkEventAny *e, gpointer p); #define UNNAMED_FILE "(Unnamed)" -ViewGtk::ViewGtk() +void +ViewGtk::initialize_impl(void) { sci = SCINTILLA(scintilla_new()); /* @@ -70,17 +71,7 @@ ViewGtk::ViewGtk() g_signal_connect(G_OBJECT(sci), SCINTILLA_NOTIFY, G_CALLBACK(scintilla_notify), NULL); - initialize(); -} - -ViewGtk::~ViewGtk() -{ - /* - * This does NOT destroy the Scintilla object - * and GTK widget, if it is the current view - * (and therefore added to the vbox). - */ - g_object_unref(G_OBJECT(sci)); + setup(); } void -- cgit v1.2.3