diff options
| author | Kris De Gussem <kris.degussem@gmail.com> | 2012-09-20 20:40:55 +0000 |
|---|---|---|
| committer | Kris <Kris.De.Gussem@hotmail.com> | 2012-09-20 20:40:55 +0000 |
| commit | bac4df147de363a0774548acd63d367a09ab50d3 (patch) | |
| tree | 849f3bc54cfa4ba5d9e219173bcc5d5240b38375 /src/attribute-rel-util.cpp | |
| parent | Translations. inkscape.pot update. (diff) | |
| download | inkscape-bac4df147de363a0774548acd63d367a09ab50d3.tar.gz inkscape-bac4df147de363a0774548acd63d367a09ab50d3.zip | |
some memleak fixes (Bug #1043571)
(bzr r11686)
Diffstat (limited to 'src/attribute-rel-util.cpp')
| -rw-r--r-- | src/attribute-rel-util.cpp | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/attribute-rel-util.cpp b/src/attribute-rel-util.cpp index 239e359e2..cf94c0c1e 100644 --- a/src/attribute-rel-util.cpp +++ b/src/attribute-rel-util.cpp @@ -128,17 +128,13 @@ void sp_attribute_clean_style(Node *repr, unsigned int flags) { // Find element's style SPCSSAttr *css = sp_repr_css_attr( repr, "style" ); - sp_attribute_clean_style(repr, css, flags); - // g_warning( "sp_repr_write_stream_element(): Final style:" ); - //sp_repr_css_print( css ); - // Convert css node's properties data to string and set repr node's attribute "style" to that string. // sp_repr_css_set( repr, css, "style"); // Don't use as it will cause loop. - gchar *value = sp_repr_css_write_string(css); - repr->setAttribute("style", value); - if (value) g_free (value); + Glib::ustring value; + sp_repr_css_write_string(css, value); + repr->setAttribute("style", value.c_str()); sp_repr_css_attr_unref( css ); } @@ -147,7 +143,7 @@ void sp_attribute_clean_style(Node *repr, unsigned int flags) { /** * Clean CSS style on an element. */ -gchar * sp_attribute_clean_style(Node *repr, gchar const *string, unsigned int flags) { +Glib::ustring sp_attribute_clean_style(Node *repr, gchar const *string, unsigned int flags) { g_return_val_if_fail (repr != NULL, NULL); g_return_val_if_fail (repr->type() == Inkscape::XML::ELEMENT_NODE, NULL); @@ -155,11 +151,12 @@ gchar * sp_attribute_clean_style(Node *repr, gchar const *string, unsigned int f SPCSSAttr *css = sp_repr_css_attr_new(); sp_repr_css_attr_add_from_string( css, string ); sp_attribute_clean_style(repr, css, flags); - gchar* string_cleaned = sp_repr_css_write_string( css ); + Glib::ustring string_cleaned; + sp_repr_css_write_string (css, string_cleaned); sp_repr_css_attr_unref( css ); - return string_cleaned; + return string_cleaned; } |
