From: buliabyak Date: Sat, 20 Sep 2008 23:46:21 +0000 (+0000) Subject: fix overreffing of reprs by clones: only ref a repr by a non-cloned SPObject X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=8df8c8f1444894d9b1fee02396c5f36448e712e0;p=inkscape.git fix overreffing of reprs by clones: only ref a repr by a non-cloned SPObject --- diff --git a/src/sp-object.cpp b/src/sp-object.cpp index 83bb7282c..0153fedc2 100644 --- a/src/sp-object.cpp +++ b/src/sp-object.cpp @@ -817,7 +817,8 @@ sp_object_invoke_build(SPObject *object, SPDocument *document, Inkscape::XML::No object->document = document; object->repr = repr; - Inkscape::GC::anchor(repr); + if (!cloned) + Inkscape::GC::anchor(repr); object->cloned = cloned; if (!SP_OBJECT_IS_CLONED(object)) { @@ -885,6 +886,8 @@ void SPObject::releaseReferences() { this->_default_label = NULL; this->document->bindObjectToRepr(this->repr, NULL); + + Inkscape::GC::release(this->repr); } else { g_assert(!this->id); } @@ -893,8 +896,6 @@ void SPObject::releaseReferences() { this->style = sp_style_unref(this->style); } - Inkscape::GC::release(this->repr); - this->document = NULL; this->repr = NULL; }