diff --git a/src/sp-object.cpp b/src/sp-object.cpp
index 83bb7282c44dd5b617192d5c7d3cdbf397365f93..1e7c5f2fe33b3d02c780a369bcc053f67a650e43 100644 (file)
--- 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)) {
this->_default_label = NULL;
this->document->bindObjectToRepr(this->repr, NULL);
+
+ Inkscape::GC::release(this->repr);
} else {
g_assert(!this->id);
}
this->style = sp_style_unref(this->style);
}
- Inkscape::GC::release(this->repr);
-
this->document = NULL;
this->repr = NULL;
}
}
}
- if (((SPObjectClass *) G_OBJECT_GET_CLASS(this))->update)
- ((SPObjectClass *) G_OBJECT_GET_CLASS(this))->update(this, ctx, flags);
+ try
+ {
+ if (((SPObjectClass *) G_OBJECT_GET_CLASS(this))->update)
+ ((SPObjectClass *) G_OBJECT_GET_CLASS(this))->update(this, ctx, flags);
+ }
+ catch(...)
+ {
+ /** \todo
+ * in case of catching an exception we need to inform the user somehow that the document is corrupted
+ * maybe by implementing an document flag documentOk
+ * or by a modal error dialog
+ */
+ g_warning("SPObject::updateDisplay(SPCtx *ctx, unsigned int flags) : throw in ((SPObjectClass *) G_OBJECT_GET_CLASS(this))->update(this, ctx, flags);");
+ }
update_in_progress --;
}