Code

properly detach SPObject from repr when deleting clone
authorbuliabyak <buliabyak@users.sourceforge.net>
Sat, 20 Sep 2008 23:58:20 +0000 (23:58 +0000)
committerbuliabyak <buliabyak@users.sourceforge.net>
Sat, 20 Sep 2008 23:58:20 +0000 (23:58 +0000)
src/sp-use.cpp

index 213f827ef2dfa12b9bdcd32133b7ae697ab50c2c..8b63217455f280c7f4d4452967cdc8302126d689 100644 (file)
@@ -139,6 +139,12 @@ sp_use_finalize(GObject *obj)
 {
     SPUse *use = (SPUse *) obj;
 
+    if (use->child) {
+        sp_object_detach(SP_OBJECT(obj), use->child);
+        use->child = NULL;
+    }
+
+    use->ref->detach();
     delete use->ref;
 
     use->_delete_connection.~connection();
@@ -170,7 +176,10 @@ sp_use_release(SPObject *object)
 {
     SPUse *use = SP_USE(object);
 
-    use->child = NULL;
+    if (use->child) {
+        sp_object_detach(object, use->child);
+        use->child = NULL;
+    }
 
     use->_delete_connection.disconnect();
     use->_changed_connection.disconnect();