Code

release reprs properly
authorbuliabyak <buliabyak@users.sourceforge.net>
Sat, 20 Sep 2008 23:37:34 +0000 (23:37 +0000)
committerbuliabyak <buliabyak@users.sourceforge.net>
Sat, 20 Sep 2008 23:37:34 +0000 (23:37 +0000)
src/dialogs/xml-tree.cpp
src/extension/effect.cpp
src/extension/internal/bluredge.cpp
src/extension/internal/cairo-renderer.cpp
src/extension/internal/filter/filter.cpp
src/extension/internal/grid.cpp
src/extension/param/parameter.cpp
src/ui/context-menu.cpp
src/ui/dialog/filter-effects-dialog.cpp
src/widgets/gradient-vector.cpp

index 33ac02a9b0df915c5dd9347bc771dd1a8ce5002c..89892aab48ed1d39aec805d67a468aa660f16de8 100644 (file)
@@ -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);
index 615aeac7ae90d4ec006ea92d49f6992eee4597f7..e6b1bf60be0c5d0f791c76f6fd74a67127e96af1 100644 (file)
@@ -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;
 }
 
index cf133407a33b024a97b3850ba4e2ae56a0dc8315..80454f9edbdda7f2782e04c15f7dc4ab1c12216e 100644 (file)
@@ -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);
index 2b74c6f7ca95830eea40b4b705d71c1fec72c065..acddc1f9d639969287ef7193e00358668ee56219 100644 (file)
@@ -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);
index b2a55b6e6154a9c1522378bd133ad66185f32408..1ba0ce8cac6379485f4d54bc923ed5a3c6e3c389 100644 (file)
@@ -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);
                }
     }
 
index 729b53cfd4f5c3a009b7b2fb37acf031fd1a55c0..cdd02882a82e6ea171de9629bdf028a5fa647208 100644 (file)
@@ -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;
 }
index 6d1a1570c2f52a406000e222c9b993454c039ee4..5f434e5e13b28dd7a6aa972a5c74ce7d109c654d 100644 (file)
@@ -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;
index 51b4b3f43c1b321fa2564c5acf5c7a3e7fd4ca95..aa93ffed9da47b9857f20f55b8918a914b0b59b3 100644 (file)
@@ -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"));
 
index 6571f4e978d9674428700df9e613dbcd9ad983be..06bc0dd733642057b0360c70dfe2145a481bd9ba 100644 (file)
@@ -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"));
index 991e415d5eef98544efd1cc618bf9094224a1ac7..881f346285ffadb277413cebc13aa19e8c83be12 100644 (file)
@@ -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);
        }
 }