summaryrefslogtreecommitdiffstats
path: root/src/xml/simple-node.cpp
diff options
context:
space:
mode:
authorKris De Gussem <kris.degussem@gmail.com>2012-09-03 06:35:01 +0000
committerKris <Kris.De.Gussem@hotmail.com>2012-09-03 06:35:01 +0000
commitd4f5006264e2e19a9fe50968a2e422b83785821c (patch)
tree934174c6829e8a96dbffa5f6207d462723fbedca /src/xml/simple-node.cpp
parentFix for 422644 : Show filename in statusbar on saving (diff)
downloadinkscape-d4f5006264e2e19a9fe50968a2e422b83785821c.tar.gz
inkscape-d4f5006264e2e19a9fe50968a2e422b83785821c.zip
revert rev 11646: build issue with dbus (forgot to adapt some more, dbus was not enabled) and other issues
(bzr r11649)
Diffstat (limited to 'src/xml/simple-node.cpp')
-rw-r--r--src/xml/simple-node.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/xml/simple-node.cpp b/src/xml/simple-node.cpp
index 3d59647cf..c197d648b 100644
--- a/src/xml/simple-node.cpp
+++ b/src/xml/simple-node.cpp
@@ -320,7 +320,7 @@ SimpleNode::setAttribute(gchar const *name, gchar const *value, bool const /*is_
Glib::ustring element = g_quark_to_string(_name);
//g_warning("setAttribute: %s: %s: %s", element.c_str(), name, value);
- Glib::ustring cleaned_value = (value ? value : Glib::ustring());
+ gchar* cleaned_value = g_strdup( value );
// Only check elements in SVG name space and don't block setting attribute to NULL.
if( element.substr(0,4) == "svg:" && value != NULL) {
@@ -338,6 +338,7 @@ SimpleNode::setAttribute(gchar const *name, gchar const *value, bool const /*is_
if( (attr_warn || attr_remove) && value != NULL ) {
bool is_useful = sp_attribute_check_attribute( element, id, name, attr_warn );
if( !is_useful && attr_remove ) {
+ g_free( cleaned_value );
return; // Don't add to tree.
}
}
@@ -345,6 +346,7 @@ SimpleNode::setAttribute(gchar const *name, gchar const *value, bool const /*is_
// Check style properties -- Note: if element is not yet inserted into
// tree (and thus has no parent), default values will not be tested.
if( !strcmp( name, "style" ) && (flags >= SP_ATTR_CLEAN_STYLE_WARN) ) {
+ g_free( cleaned_value );
cleaned_value = sp_attribute_clean_style( this, value, flags );
// if( g_strcmp0( value, cleaned_value ) ) {
// g_warning( "SimpleNode::setAttribute: %s", id.c_str() );
@@ -370,8 +372,8 @@ SimpleNode::setAttribute(gchar const *name, gchar const *value, bool const /*is_
ptr_shared<char> old_value=( existing ? existing->value : ptr_shared<char>() );
ptr_shared<char> new_value=ptr_shared<char>();
- if (~cleaned_value.empty()) {
- new_value = share_string(cleaned_value.c_str());
+ if (cleaned_value) {
+ new_value = share_string(cleaned_value);
tracker.set<DebugSetAttribute>(*this, key, new_value);
if (!existing) {
if (ref) {
@@ -399,6 +401,9 @@ SimpleNode::setAttribute(gchar const *name, gchar const *value, bool const /*is_
_observers.notifyAttributeChanged(*this, key, old_value, new_value);
//g_warning( "setAttribute notified: %s: %s: %s: %s", name, element.c_str(), old_value, new_value );
}
+
+ g_free( cleaned_value );
+
}
void SimpleNode::addChild(Node *generic_child, Node *generic_ref) {