diff options
| author | Thomas Martitz <thomas.martitz@student.htw-berlin.de> | 2013-11-16 09:34:47 +1100 |
|---|---|---|
| committer | Thomas Martitz <thomas.martitz@student.htw-berlin.de> | 2013-11-16 09:34:47 +1100 |
| commit | 3248620b402246620855acd33fff375301931c36 (patch) | |
| tree | 1d721330f527d5ecec869cb3cd2cb35a09f49f75 | |
| parent | 3288ef280b52b3b8d8ddf9be6ea16b46788ed6bb (diff) | |
| download | scintilla-mirror-3248620b402246620855acd33fff375301931c36.tar.gz | |
ScintillaGTK: Call superclass finalize() in ScintillaObject
The ScintillaObject class does not chain up to its superclass in the finalize()
function. This is a bug and must be done according to the GLib/GObject
documentation. One effect of this is that the destroy notifiers supplied in
e.g. g_object_set_data_full() are never run.
Fixes Bug: #1549 ScintillaObject.finalize() does not chain up
| -rw-r--r-- | gtk/ScintillaGTK.cxx | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/gtk/ScintillaGTK.cxx b/gtk/ScintillaGTK.cxx index 3a403ac7e..b0e99e7a6 100644 --- a/gtk/ScintillaGTK.cxx +++ b/gtk/ScintillaGTK.cxx @@ -2343,9 +2343,12 @@ void ScintillaGTK::RealizeText(GtkWidget *widget, void*) { } } +static GObjectClass *scintilla_class_parent_class; + void ScintillaGTK::Destroy(GObject *object) { try { ScintillaObject *scio = reinterpret_cast<ScintillaObject *>(object); + // This avoids a double destruction if (!scio->pscin) return; @@ -2355,10 +2358,7 @@ void ScintillaGTK::Destroy(GObject *object) { delete sciThis; scio->pscin = 0; - // Always chain up to the parent class - GType parent_type = g_type_parent(scintilla_get_type()); // GTK_TYPE_CONTAINER - GObjectClass *parent = G_OBJECT_CLASS(g_type_class_peek(parent_type)); - parent->finalize(object); + scintilla_class_parent_class->finalize(object); } catch (...) { // Its dead so nowhere to save the status } @@ -2921,7 +2921,7 @@ static void scintilla_class_init(ScintillaClass *klass) { klass->command = NULL; klass->notify = NULL; - + scintilla_class_parent_class = G_OBJECT_CLASS(g_type_class_peek_parent(klass)); ScintillaGTK::ClassInit(object_class, widget_class, container_class); } catch (...) { } |
