diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2014-11-16 23:46:08 +0100 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2014-11-17 03:56:42 +0100 |
commit | 2542eb02648294256a01ae4ecb6ac81bc8ab5094 (patch) | |
tree | 81166dbe78031f7764ca2d6d4925d96283ac29c5 /src/interface-gtk.h | |
parent | e762a43754ba375789fa749ca2e00a3548500d6a (diff) | |
download | sciteco-2542eb02648294256a01ae4ecb6ac81bc8ab5094.tar.gz |
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
Diffstat (limited to 'src/interface-gtk.h')
-rw-r--r-- | src/interface-gtk.h | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/interface-gtk.h b/src/interface-gtk.h index 5a083ab..6c8e055 100644 --- a/src/interface-gtk.h +++ b/src/interface-gtk.h @@ -34,8 +34,21 @@ typedef class ViewGtk : public View<ViewGtk> { ScintillaObject *sci; public: - ViewGtk(); - ~ViewGtk(); + ViewGtk() : sci(NULL) {} + + /* implementation of View::initialize() */ + void initialize_impl(void); + + inline ~ViewGtk() + { + /* + * This does NOT destroy the Scintilla object + * and GTK widget, if it is the current view + * (and therefore added to the vbox). + */ + if (sci) + g_object_unref(G_OBJECT(sci)); + } inline GtkWidget * get_widget(void) |