From 54f21698664f3b4ae65a4ece376dc404212a2639 Mon Sep 17 00:00:00 2001 From: Krzysztof Kosi??ski Date: Fri, 31 Jan 2014 22:56:58 +0100 Subject: Do not throw TypeNotRegistered exceptions for now, since they interfere with debugging via 'catch throw'. (bzr r12991) --- src/sp-object.cpp | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) (limited to 'src/sp-object.cpp') 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); } } -- cgit v1.2.3