summaryrefslogtreecommitdiffstats
path: root/src/sp-object.cpp
diff options
context:
space:
mode:
authorKrzysztof Kosi??ski <tweenk.pl@gmail.com>2014-01-31 21:56:58 +0000
committerKrzysztof KosiƄski <tweenk.pl@gmail.com>2014-01-31 21:56:58 +0000
commit54f21698664f3b4ae65a4ece376dc404212a2639 (patch)
treefe5ae3ee1d255f59c5a0fca8ec335b0cf4284bff /src/sp-object.cpp
parentsimplify equations in get_scale_transform_for_variable_stroke() for the case ... (diff)
downloadinkscape-54f21698664f3b4ae65a4ece376dc404212a2639.tar.gz
inkscape-54f21698664f3b4ae65a4ece376dc404212a2639.zip
Do not throw TypeNotRegistered exceptions for now, since they interfere
with debugging via 'catch throw'. (bzr r12991)
Diffstat (limited to 'src/sp-object.cpp')
-rw-r--r--src/sp-object.cpp34
1 files changed, 16 insertions, 18 deletions
diff --git a/src/sp-object.cpp b/src/sp-object.cpp
index 0e6eef6ae..764b5f260 100644
--- a/src/sp-object.cpp
+++ b/src/sp-object.cpp
@@ -585,23 +585,22 @@ SPObject *SPObject::get_child_by_repr(Inkscape::XML::Node *repr)
void SPObject::child_added(Inkscape::XML::Node *child, Inkscape::XML::Node *ref) {
SPObject* object = this;
- try {
- const std::string typeString = NodeTraits::get_type_string(*child);
+ const std::string type_string = NodeTraits::get_type_string(*child);
- SPObject* ochild = SPFactory::instance().createObject(typeString);
-
- SPObject *prev = ref ? object->get_child_by_repr(ref) : NULL;
- object->attach(ochild, prev);
- sp_object_unref(ochild, NULL);
-
- ochild->invoke_build(object->document, child, object->cloned);
- } catch (const FactoryExceptions::TypeNotRegistered& e) {
+ SPObject* ochild = SPFactory::instance().createObject(type_string);
+ if (ochild == NULL) {
// Currenty, there are many node types that do not have
// corresponding classes in the SPObject tree.
// (rdf:RDF, inkscape:clipboard, ...)
// Thus, simply ignore this case for now.
return;
}
+
+ SPObject *prev = ref ? object->get_child_by_repr(ref) : NULL;
+ object->attach(ochild, prev);
+ sp_object_unref(ochild, NULL);
+
+ ochild->invoke_build(object->document, child, object->cloned);
}
void SPObject::release() {
@@ -645,21 +644,20 @@ void SPObject::build(SPDocument *document, Inkscape::XML::Node *repr) {
object->readAttr("inkscape:collect");
for (Inkscape::XML::Node *rchild = repr->firstChild() ; rchild != NULL; rchild = rchild->next()) {
- try {
- const std::string typeString = NodeTraits::get_type_string(*rchild);
-
- SPObject* child = SPFactory::instance().createObject(typeString);
+ const std::string typeString = NodeTraits::get_type_string(*rchild);
- object->attach(child, object->lastChild());
- sp_object_unref(child, NULL);
- child->invoke_build(document, rchild, object->cloned);
- } catch (const FactoryExceptions::TypeNotRegistered& e) {
+ SPObject* child = SPFactory::instance().createObject(typeString);
+ if (child == NULL) {
// Currenty, there are many node types that do not have
// corresponding classes in the SPObject tree.
// (rdf:RDF, inkscape:clipboard, ...)
// Thus, simply ignore this case for now.
continue;
}
+
+ object->attach(child, object->lastChild());
+ sp_object_unref(child, NULL);
+ child->invoke_build(document, rchild, object->cloned);
}
}