From 96d7f74ab56c7ce6cf9df0108ce925f59bcf0035 Mon Sep 17 00:00:00 2001 From: buliabyak Date: Sat, 19 Jul 2008 04:33:41 +0000 Subject: [PATCH] fix crash when simplifying an lpe path: deleting the list didn't release the references, and it didn't work in _finalize anyway --- src/sp-lpe-item.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/sp-lpe-item.cpp b/src/sp-lpe-item.cpp index 229ae326e..2eecd8e45 100644 --- a/src/sp-lpe-item.cpp +++ b/src/sp-lpe-item.cpp @@ -129,8 +129,6 @@ sp_lpe_item_finalize(GObject *object) if (((GObjectClass *) (parent_class))->finalize) { (* ((GObjectClass *) (parent_class))->finalize)(object); } - - delete SP_LPE_ITEM(object)->path_effect_list; } /** @@ -154,12 +152,21 @@ sp_lpe_item_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *r static void sp_lpe_item_release(SPObject *object) { - SPLPEItem *lpeitem; - lpeitem = (SPLPEItem *) object; + SPLPEItem *lpeitem = (SPLPEItem *) object; lpeitem->lpe_modified_connection.disconnect(); lpeitem->lpe_modified_connection.~connection(); + PathEffectList::iterator it = lpeitem->path_effect_list->begin(); + while ( it != lpeitem->path_effect_list->end() ) { + // unlink and delete all references in the list + (*it)->unlink(); + delete *it; + it = lpeitem->path_effect_list->erase(it); + } + // delete the list itself + delete SP_LPE_ITEM(object)->path_effect_list; + if (((SPObjectClass *) parent_class)->release) ((SPObjectClass *) parent_class)->release(object); } -- 2.30.2