From 9eed1886cdd1a3412687d10ccf99a6aaadd89154 Mon Sep 17 00:00:00 2001 From: buliabyak Date: Sat, 20 Sep 2008 23:37:34 +0000 Subject: [PATCH] release reprs properly --- src/dialogs/xml-tree.cpp | 1 + src/extension/effect.cpp | 2 ++ src/extension/internal/bluredge.cpp | 1 + src/extension/internal/cairo-renderer.cpp | 1 + src/extension/internal/filter/filter.cpp | 5 +++++ src/extension/internal/grid.cpp | 1 + src/extension/param/parameter.cpp | 2 ++ src/ui/context-menu.cpp | 4 ++++ src/ui/dialog/filter-effects-dialog.cpp | 1 + src/widgets/gradient-vector.cpp | 3 +++ 10 files changed, 21 insertions(+) diff --git a/src/dialogs/xml-tree.cpp b/src/dialogs/xml-tree.cpp index 33ac02a9b..89892aab4 100644 --- a/src/dialogs/xml-tree.cpp +++ b/src/dialogs/xml-tree.cpp @@ -1381,6 +1381,7 @@ void cmd_new_element_node(GtkObject */*object*/, gpointer /*data*/) Inkscape::XML::Document *xml_doc = sp_document_repr_doc(current_document); Inkscape::XML::Node *new_repr; new_repr = xml_doc->createElement(name.text); + Inkscape::GC::release(new_repr); g_free(name.text); selected_repr->appendChild(new_repr); set_tree_select(new_repr); diff --git a/src/extension/effect.cpp b/src/extension/effect.cpp index 615aeac7a..e6b1bf60b 100644 --- a/src/extension/effect.cpp +++ b/src/extension/effect.cpp @@ -191,6 +191,8 @@ Effect::~Effect (void) { if (get_last_effect() == this) set_last_effect(NULL); + if (_menu_node) + Inkscape::GC::release(_menu_node); return; } diff --git a/src/extension/internal/bluredge.cpp b/src/extension/internal/bluredge.cpp index cf133407a..80454f9ed 100644 --- a/src/extension/internal/bluredge.cpp +++ b/src/extension/internal/bluredge.cpp @@ -106,6 +106,7 @@ BlurEdge::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View selection->clear(); } + Inkscape::GC::release(new_group); } prefs_set_double_attribute("options.defaultoffsetwidth", "value", old_offset); diff --git a/src/extension/internal/cairo-renderer.cpp b/src/extension/internal/cairo-renderer.cpp index 2b74c6f7c..acddc1f9d 100644 --- a/src/extension/internal/cairo-renderer.cpp +++ b/src/extension/internal/cairo-renderer.cpp @@ -533,6 +533,7 @@ static void sp_asbitmap_render(SPItem *item, CairoRenderContext *ctx) // add the new repr to the parent parent->appendChild(repr); + Inkscape::GC::release(repr); // move to the saved position repr->setPosition(pos > 0 ? pos + 1 : 1); diff --git a/src/extension/internal/filter/filter.cpp b/src/extension/internal/filter/filter.cpp index b2a55b6e6..1ba0ce8ca 100644 --- a/src/extension/internal/filter/filter.cpp +++ b/src/extension/internal/filter/filter.cpp @@ -107,6 +107,7 @@ Filter::merge_filters (Inkscape::XML::Node * to, Inkscape::XML::Node * from, Ink if (from_child == from->firstChild() && !strcmp("filter", from->name()) && srcGraphic != NULL && to_child->attribute("in") == NULL) { to_child->setAttribute("in", srcGraphic); } + Inkscape::GC::release(to_child); } return; @@ -143,6 +144,8 @@ Filter::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View *d Glib::ustring url = "url(#"; url += newfilterroot->attribute("id"); url += ")"; merge_filters(newfilterroot, get_filter(module)->root(), xmldoc); + + Inkscape::GC::release(newfilterroot); sp_repr_css_set_property(css, "filter", url.c_str()); sp_repr_css_set(node, css, "style"); @@ -175,6 +178,8 @@ Filter::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View *d filternode->appendChild(alpha); merge_filters(filternode, get_filter(module)->root(), xmldoc, FILTER_SRC_GRAPHIC, FILTER_SRC_GRAPHIC_ALPHA); + + Inkscape::GC::release(alpha); } } diff --git a/src/extension/internal/grid.cpp b/src/extension/internal/grid.cpp index 729b53cfd..cdd02882a 100644 --- a/src/extension/internal/grid.cpp +++ b/src/extension/internal/grid.cpp @@ -124,6 +124,7 @@ Grid::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View *doc path->setAttribute("style", style.c_str()); current_layer->appendChild(path); + Inkscape::GC::release(path); return; } diff --git a/src/extension/param/parameter.cpp b/src/extension/param/parameter.cpp index 6d1a1570c..5f434e5e1 100644 --- a/src/extension/param/parameter.cpp +++ b/src/extension/param/parameter.cpp @@ -320,6 +320,7 @@ Parameter::new_child (Inkscape::XML::Node * parent) retval->setAttribute("name", _name); parent->appendChild(retval); + Inkscape::GC::release(retval); return retval; } @@ -346,6 +347,7 @@ Parameter::document_param_node (SPDocument * doc) params = xml_doc->createElement("inkscape:extension-param"); params->setAttribute("extension", extension->get_id()); defs->appendChild(params); + Inkscape::GC::release(params); } return params; diff --git a/src/ui/context-menu.cpp b/src/ui/context-menu.cpp index 51b4b3f43..aa93ffed9 100644 --- a/src/ui/context-menu.cpp +++ b/src/ui/context-menu.cpp @@ -173,6 +173,10 @@ sp_item_create_link(GtkMenuItem *menuitem, SPItem *item) SP_OBJECT(item)->deleteObject(false); repr->addChild(child, NULL); child->setAttribute("id", id); + + Inkscape::GC::release(repr); + Inkscape::GC::release(child); + sp_document_done(SP_OBJECT_DOCUMENT(object), SP_VERB_NONE, _("Create link")); diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp index 6571f4e97..06bc0dd73 100644 --- a/src/ui/dialog/filter-effects-dialog.cpp +++ b/src/ui/dialog/filter-effects-dialog.cpp @@ -1063,6 +1063,7 @@ private: Inkscape::XML::Document *xml_doc = sp_document_repr_doc(prim->document); Inkscape::XML::Node *repr = xml_doc->createElement(_light_source.get_active_data()->key.c_str()); prim->repr->appendChild(repr); + Inkscape::GC::release(repr); } sp_document_done(prim->document, SP_VERB_DIALOG_FILTER_EFFECTS, _("New light source")); diff --git a/src/widgets/gradient-vector.cpp b/src/widgets/gradient-vector.cpp index 991e415d5..881f34628 100644 --- a/src/widgets/gradient-vector.cpp +++ b/src/widgets/gradient-vector.cpp @@ -480,17 +480,20 @@ verify_grad(SPGradient *gradient) sp_repr_set_css_double(child, "offset", 0.0); child->setAttribute("style", os.str().c_str()); SP_OBJECT_REPR (gradient)->addChild(child, NULL); + Inkscape::GC::release(child); child = xml_doc->createElement("svg:stop"); sp_repr_set_css_double(child, "offset", 1.0); child->setAttribute("style", os.str().c_str()); SP_OBJECT_REPR (gradient)->addChild(child, NULL); + Inkscape::GC::release(child); } if (i < 2) { sp_repr_set_css_double(SP_OBJECT_REPR(stop), "offset", 0.0); Inkscape::XML::Node *child = SP_OBJECT_REPR(stop)->duplicate(SP_OBJECT_REPR(gradient)->document()); sp_repr_set_css_double(child, "offset", 1.0); SP_OBJECT_REPR(gradient)->addChild(child, SP_OBJECT_REPR (stop)); + Inkscape::GC::release(child); } } -- 2.30.2