dia r3956 - in trunk: . objects/custom
- From: hans svn gnome org
- To: svn-commits-list gnome org
- Subject: dia r3956 - in trunk: . objects/custom
- Date: Fri, 25 Apr 2008 19:55:27 +0100 (BST)
Author: hans
Date: Fri Apr 25 18:55:27 2008
New Revision: 3956
URL: http://svn.gnome.org/viewvc/dia?rev=3956&view=rev
Log:
2008-04-25 Hans Breuer <hans breuer org>
* objects/custom/shape_info.c : don't mess with info->icon after
preload (valgrind complained about invalid reads of free'd strings
and sometimes there was a missing icon in the toolbox. Also fixed
some type cast warnings
Modified:
trunk/ChangeLog
trunk/objects/custom/shape_info.c
Modified: trunk/objects/custom/shape_info.c
==============================================================================
--- trunk/objects/custom/shape_info.c (original)
+++ trunk/objects/custom/shape_info.c Fri Apr 25 18:55:27 2008
@@ -191,12 +191,12 @@
}
static gboolean
-is_subshape(xmlElement* elt)
+is_subshape(xmlNode* node)
{
gboolean res = FALSE;
- if (xmlHasProp(elt, "subshape")) {
- gchar* value = xmlGetProp(elt, "subshape");
+ if (xmlHasProp(node, "subshape")) {
+ gchar* value = xmlGetProp(node, "subshape");
if (!strcmp(value, "true"))
res = TRUE;
@@ -453,7 +453,7 @@
xmlFree(str);
}
} else if (!xmlStrcmp(node->name, (const xmlChar *)"g")) {
- if (!is_subshape((xmlElement*)node)) {
+ if (!is_subshape(node)) {
/* add elements from the group element */
parse_svg_node(info, node, svg_ns, &s, filename);
} else {
@@ -467,8 +467,8 @@
DIA_SVG_LINEJOIN_DEFAULT,
DIA_SVG_LINESTYLE_DEFAULT, 1.0
};
- xmlAttrPtr v_anchor_attr = xmlGetProp(node,"v_anchor");
- xmlAttrPtr h_anchor_attr = xmlGetProp(node,"h_anchor");
+ xmlChar *v_anchor_attr = xmlGetProp(node,"v_anchor");
+ xmlChar *h_anchor_attr = xmlGetProp(node,"h_anchor");
parse_svg_node(tmpinfo, node, svg_ns, &tmp_s, filename);
@@ -683,8 +683,14 @@
xmlFree(tmp);
} else if (node->ns == shape_ns && !xmlStrcmp(node->name, (const xmlChar *)"icon")) {
tmp = (gchar *) xmlNodeGetContent(node);
- g_free(info->icon);
- info->icon = custom_get_relative_filename(filename, tmp);
+ if (preload) {
+ if (strstr (info->icon, tmp) == NULL) /* the left including the absolute path */
+ g_warning ("Shape(preload) '%s' can't change icon '%s'", info->icon, tmp);
+ /* the key name is already used as key in name_to_info */
+ } else {
+ g_free(info->icon);
+ info->icon = custom_get_relative_filename(filename, tmp);
+ }
xmlFree(tmp);
} else if (node->ns == shape_ns && !xmlStrcmp(node->name, (const xmlChar *)"connections")) {
GArray *arr = g_array_new(FALSE, FALSE, sizeof(Point));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]