If the PsppireDict is destroyed before its dictionary, then it is important to avoid getting callbacks into the freed PsppireDict. --- src/ui/gui/psppire-dict.c | 18 +++++++++++++++--- 1 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/src/ui/gui/psppire-dict.c b/src/ui/gui/psppire-dict.c index 343fbd0..e6291b6 100644 --- a/src/ui/gui/psppire-dict.c +++ b/src/ui/gui/psppire-dict.c @@ -56,6 +56,7 @@ enum { /* --- prototypes --- */ static void psppire_dict_class_init (PsppireDictClass *class); static void psppire_dict_init (PsppireDict *dict); +static void psppire_dict_dispose (GObject *object); static void dictionary_tree_model_init (GtkTreeModelIface *iface); @@ -110,8 +111,12 @@ psppire_dict_get_type (void) static void psppire_dict_class_init (PsppireDictClass *class) { + GObjectClass *object_class = G_OBJECT_CLASS (class); + parent_class = g_type_class_peek_parent (class); + object_class->dispose = psppire_dict_dispose; + signals [BACKEND_CHANGED] = g_signal_new ("backend-changed", G_TYPE_FROM_CLASS (class), @@ -221,6 +226,16 @@ psppire_dict_class_init (PsppireDictClass *class) 0); } +static void +psppire_dict_dispose (GObject *object) +{ + PsppireDict *d = PSPPIRE_DICT (object); + + dict_set_callbacks (d->dict, NULL, NULL); + + G_OBJECT_CLASS (parent_class)->dispose (object); +} + /* Pass on callbacks from src/data/dictionary, as signals in the Gtk library */ static void @@ -302,9 +317,6 @@ psppire_dict_init (PsppireDict *psppire_dict) * @returns: a new #PsppireDict object * * Creates a new #PsppireDict. - * - * A #PsppireDict does not own its dictionary, that is, when the #PsppireDict - * is destroyed it does not destroy the underlying #struct dictionary. */ PsppireDict* psppire_dict_new_from_dict (struct dictionary *d) -- 1.7.2.5 _______________________________________________ pspp-dev mailing list pspp-dev@gnu.org https://lists.gnu.org/mailman/listinfo/pspp-dev