diff options
| author | Markus Engel <markus.engel@tum.de> | 2013-10-13 20:00:27 +0000 |
|---|---|---|
| committer | Markus Engel <markus.engel@tum.de> | 2013-10-13 20:00:27 +0000 |
| commit | 6af55a0be21d302ef07185527e7e92ad220c6a58 (patch) | |
| tree | 0e2fbadf8e13a11ba56fb37c7e6b5005a1a9eb74 /src/sp-object.cpp | |
| parent | UI message generalisation (diff) | |
| download | inkscape-6af55a0be21d302ef07185527e7e92ad220c6a58.tar.gz inkscape-6af55a0be21d302ef07185527e7e92ad220c6a58.zip | |
Changes to object creation. Fixes some warning in new from template.
Fixed bugs:
- https://launchpad.net/bugs/1239419
(bzr r12686)
Diffstat (limited to 'src/sp-object.cpp')
| -rw-r--r-- | src/sp-object.cpp | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/src/sp-object.cpp b/src/sp-object.cpp index 6fd4de43b..8c54caf48 100644 --- a/src/sp-object.cpp +++ b/src/sp-object.cpp @@ -596,14 +596,11 @@ void SPObject::child_added(Inkscape::XML::Node *child, Inkscape::XML::Node *ref) ochild->invoke_build(object->document, child, object->cloned); } catch (const FactoryExceptions::TypeNotRegistered& e) { - std::string node = e.what(); - - // special cases - if (node.empty()) return; // comments, usually - if (node == "rdf:RDF") return; // no SP node yet - if (node == "inkscape:clipboard") return; // SP node not necessary - - g_warning("TypeNotRegistered exception: %s", e.what()); + // 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; } } @@ -617,13 +614,13 @@ void SPObject::release() { } void SPObject::remove_child(Inkscape::XML::Node* child) { - SPObject* object = this; + debug("id=%x, typename=%s", this, g_type_name_from_instance((GTypeInstance*)this)); - debug("id=%x, typename=%s", object, g_type_name_from_instance((GTypeInstance*)object)); - SPObject *ochild = object->get_child_by_repr(child); - g_return_if_fail (ochild != NULL || !strcmp("comment", child->name())); // comments have no objects + SPObject *ochild = this->get_child_by_repr(child); + + // If the xml node has got a corresponding child in the object tree if (ochild) { - object->detach(ochild); + this->detach(ochild); } } @@ -662,7 +659,11 @@ void SPObject::build(SPDocument *document, Inkscape::XML::Node *repr) { sp_object_unref(child, NULL); child->invoke_build(document, rchild, object->cloned); } catch (const FactoryExceptions::TypeNotRegistered& e) { - g_warning("TypeNotRegistered exception: %s", e.what()); + // 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; } } } |
