aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorThomas Martitz <thomas.martitz@student.htw-berlin.de>2013-11-16 09:34:47 +1100
committerThomas Martitz <thomas.martitz@student.htw-berlin.de>2013-11-16 09:34:47 +1100
commit72f45b272e2dd719105509f714ab51f5b67a75b0 (patch)
treecf954af2248978a20e110ee787e9371ad7ca441e
parent29828ee21f036ffeaaf23e0501489638dca02eb5 (diff)
downloadscintilla-mirror-72f45b272e2dd719105509f714ab51f5b67a75b0.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.cxx10
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 (...) {
}