Code

fix overreffing of reprs by clones: only ref a repr by a non-cloned SPObject
authorbuliabyak <buliabyak@users.sourceforge.net>
Sat, 20 Sep 2008 23:46:21 +0000 (23:46 +0000)
committerbuliabyak <buliabyak@users.sourceforge.net>
Sat, 20 Sep 2008 23:46:21 +0000 (23:46 +0000)
src/sp-object.cpp

index 83bb7282c44dd5b617192d5c7d3cdbf397365f93..0153fedc2e84d22bddecd9d6bd657c9c8acb199e 100644 (file)
@@ -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;
 }