summaryrefslogtreecommitdiff
path: root/gtk/gtkuimanager.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2004-04-13 20:06:12 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2004-04-13 20:06:12 +0000
commit157943b584fc9251f10154a630acc056ae73af82 (patch)
treec0dfce62f4f1afb16c43b3c7619c73026cab3282 /gtk/gtkuimanager.c
parent5854707bd97fa9b5206353a98dbcfa4b578c4604 (diff)
downloadgtk+-157943b584fc9251f10154a630acc056ae73af82.tar.gz
Don't crash if a node has no name. (start_element_handler): Accept
2004-04-13 Matthias Clasen <mclasen@redhat.com> * gtk/gtkuimanager.c (get_child_node): Don't crash if a node has no name. (start_element_handler): Accept separators without unique names. (#133302, Anders Carlsson) * gtk/gtkuimanager.c (node_remove_ui_reference): Don't leak list nodes. (#138862, Morten Welinder)
Diffstat (limited to 'gtk/gtkuimanager.c')
-rw-r--r--gtk/gtkuimanager.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/gtk/gtkuimanager.c b/gtk/gtkuimanager.c
index f1fde1382b..93ab1a067c 100644
--- a/gtk/gtkuimanager.c
+++ b/gtk/gtkuimanager.c
@@ -824,7 +824,8 @@ get_child_node (GtkUIManager *self,
{
for (child = parent->children; child != NULL; child = child->next)
{
- if (strlen (NODE_INFO (child)->name) == childname_length &&
+ if (NODE_INFO (child)->name &&
+ strlen (NODE_INFO (child)->name) == childname_length &&
!strncmp (NODE_INFO (child)->name, childname, childname_length))
{
/* if undecided about node type, set it */
@@ -1215,15 +1216,24 @@ start_element_handler (GMarkupParseContext *context,
!strcmp (element_name, "separator"))
{
GNode *node;
+ gint length;
if (ctx->state == STATE_TOOLBAR)
ctx->state = STATE_TOOLITEM;
else
ctx->state = STATE_MENUITEM;
+ if (!strcmp (node_name, "separator"))
+ {
+ node_name = NULL;
+ length = -1;
+ }
+ else
+ length = strlen (node_name);
node = get_child_node (self, ctx->current,
- node_name, strlen (node_name),
+ node_name, length,
NODE_TYPE_SEPARATOR,
TRUE, top);
+
if (NODE_INFO (node)->action_name == 0)
NODE_INFO (node)->action_name = action_quark;