summaryrefslogtreecommitdiffstats
path: root/src/extension/dbus/document-interface.cpp
diff options
context:
space:
mode:
authorKris De Gussem <kris.degussem@gmail.com>2012-09-20 20:40:55 +0000
committerKris <Kris.De.Gussem@hotmail.com>2012-09-20 20:40:55 +0000
commitbac4df147de363a0774548acd63d367a09ab50d3 (patch)
tree849f3bc54cfa4ba5d9e219173bcc5d5240b38375 /src/extension/dbus/document-interface.cpp
parentTranslations. inkscape.pot update. (diff)
downloadinkscape-bac4df147de363a0774548acd63d367a09ab50d3.tar.gz
inkscape-bac4df147de363a0774548acd63d367a09ab50d3.zip
some memleak fixes (Bug #1043571)
(bzr r11686)
Diffstat (limited to 'src/extension/dbus/document-interface.cpp')
-rw-r--r--src/extension/dbus/document-interface.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/extension/dbus/document-interface.cpp b/src/extension/dbus/document-interface.cpp
index 66d1c5dfa..56d1dfdbd 100644
--- a/src/extension/dbus/document-interface.cpp
+++ b/src/extension/dbus/document-interface.cpp
@@ -223,11 +223,12 @@ dbus_create_node (SPDesktop *desk, const gchar *type)
*/
gchar *finish_create_shape (DocumentInterface *object, GError ** /*error*/, Inkscape::XML::Node *newNode, gchar *desc)
{
-
SPCSSAttr *style = sp_desktop_get_style(object->desk, TRUE);
if (style) {
- newNode->setAttribute("style", sp_repr_css_write_string(style), TRUE);
+ Glib::ustring str;
+ sp_repr_css_write_string(style, str);
+ newNode->setAttribute("style", str.c_str(), TRUE);
}
else {
newNode->setAttribute("style", "fill:#0000ff;fill-opacity:1;stroke:#c900b9;stroke-width:0;stroke-miterlimit:0;stroke-opacity:1;stroke-dasharray:none", TRUE);
@@ -530,7 +531,7 @@ gchar *document_interface_node(DocumentInterface *object, gchar *type, GError **
}
/****************************************************************************
- ENVIORNMENT FUNCTIONS
+ ENVIRONMENT FUNCTIONS
****************************************************************************/
gdouble
document_interface_document_get_width (DocumentInterface *object)
@@ -547,7 +548,9 @@ document_interface_document_get_height (DocumentInterface *object)
gchar *document_interface_document_get_css(DocumentInterface *object, GError ** /*error*/)
{
SPCSSAttr *current = (object->desk)->current;
- return sp_repr_css_write_string(current);
+ Glib::ustring str;
+ sp_repr_css_write_string(current, str);
+ return (str.empty() ? NULL : g_strdup (str.c_str()));
}
gboolean document_interface_document_merge_css(DocumentInterface *object,
@@ -768,7 +771,9 @@ document_interface_modify_css (DocumentInterface *object, gchar *shape,
SPCSSAttr * oldstyle = sp_repr_css_attr (node, style);
sp_repr_css_set_property(oldstyle, cssattrb, newval);
- node->setAttribute (style, sp_repr_css_write_string (oldstyle), TRUE);
+ Glib::ustring str;
+ sp_repr_css_write_string (oldstyle, str);
+ node->setAttribute (style, str.c_str(), TRUE);
return TRUE;
}
@@ -791,7 +796,10 @@ document_interface_merge_css (DocumentInterface *object, gchar *shape,
SPCSSAttr * oldstyle = sp_repr_css_attr (node, style);
sp_repr_css_merge(oldstyle, newstyle);
- node->setAttribute (style, sp_repr_css_write_string (oldstyle), TRUE);
+ Glib::ustring str;
+ sp_repr_css_write_string (oldstyle, str);
+ node->setAttribute (style, str.c_str(), TRUE);
+
return TRUE;
}