aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-06-22 14:54:21 -0500
committerTed Gould <ted@gould.cx>2010-06-22 14:54:21 -0500
commit7342ce4a9d447f6a4db78f410ae68fc1470b0f00 (patch)
tree8dd7a70694fc3f1d6c49b5a6afd20d5fbf3e510e
parentba00c24b625805e7c3069165c6eea5bca5166e22 (diff)
parent9c510014f39302552350b6bc47ce47be5ec84745 (diff)
downloadlibdbusmenu-7342ce4a9d447f6a4db78f410ae68fc1470b0f00.tar.gz
libdbusmenu-7342ce4a9d447f6a4db78f410ae68fc1470b0f00.tar.bz2
libdbusmenu-7342ce4a9d447f6a4db78f410ae68fc1470b0f00.zip
* Upstream Merge
* Checking to ensure our values are what we expect
-rw-r--r--debian/changelog7
-rw-r--r--libdbusmenu-gtk/menuitem.c31
2 files changed, 33 insertions, 5 deletions
diff --git a/debian/changelog b/debian/changelog
index d5dfe16..8abbfdb 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+libdbusmenu (0.3.2-1ubuntu1~ppa4) UNRELEASED; urgency=low
+
+ * Upstream Merge
+ * Checking to ensure our values are what we expect
+
+ -- Ted Gould <ted@ubuntu.com> Tue, 22 Jun 2010 14:53:43 -0500
+
libdbusmenu (0.3.2-1ubuntu1~ppa3) lucid; urgency=low
* Upstream Merge
diff --git a/libdbusmenu-gtk/menuitem.c b/libdbusmenu-gtk/menuitem.c
index 57cd258..a7aa9d2 100644
--- a/libdbusmenu-gtk/menuitem.c
+++ b/libdbusmenu-gtk/menuitem.c
@@ -295,6 +295,10 @@ dbusmenu_menuitem_property_get_shortcut (DbusmenuMenuitem * menuitem, guint * ke
if (wrapper == NULL) {
return;
}
+ if (!G_VALUE_HOLDS(wrapper, G_TYPE_VALUE_ARRAY)) {
+ g_warning("Unexpected shortcut structure. Wrapper is: %s", G_VALUE_TYPE_NAME(wrapper));
+ return;
+ }
GValueArray * wrapperarray = (GValueArray *)g_value_get_boxed(wrapper);
if (wrapperarray->n_values == 0) {
@@ -306,6 +310,11 @@ dbusmenu_menuitem_property_get_shortcut (DbusmenuMenuitem * menuitem, guint * ke
}
GValue * ventryarray = g_value_array_get_nth(wrapperarray, 0);
+ if (!G_VALUE_HOLDS(ventryarray, G_TYPE_VALUE_ARRAY)) {
+ g_warning("Unexpected shortcut structure. Value array is: %s", G_VALUE_TYPE_NAME(ventryarray));
+ return;
+ }
+
GValueArray * entryarray = (GValueArray *)g_value_get_boxed(ventryarray);
if (entryarray->n_values == 0) {
/* Seems a little odd, but really, we're saying that it isn't a
@@ -316,19 +325,25 @@ dbusmenu_menuitem_property_get_shortcut (DbusmenuMenuitem * menuitem, guint * ke
/* Parse through modifiers */
int i;
for (i = 0; i < entryarray->n_values - 1; i++) {
- if (g_strcmp0(g_value_get_string(g_value_array_get_nth(entryarray, i)), DBUSMENU_MENUITEM_SHORTCUT_CONTROL) == 0) {
+ GValue * value = g_value_array_get_nth(entryarray, i);
+
+ if (!G_VALUE_HOLDS_STRING(value)) {
+ continue;
+ }
+
+ if (g_strcmp0(g_value_get_string(value), DBUSMENU_MENUITEM_SHORTCUT_CONTROL) == 0) {
*modifier |= GDK_CONTROL_MASK;
continue;
}
- if (g_strcmp0(g_value_get_string(g_value_array_get_nth(entryarray, i)), DBUSMENU_MENUITEM_SHORTCUT_ALT) == 0) {
+ if (g_strcmp0(g_value_get_string(value), DBUSMENU_MENUITEM_SHORTCUT_ALT) == 0) {
*modifier |= GDK_MOD1_MASK;
continue;
}
- if (g_strcmp0(g_value_get_string(g_value_array_get_nth(entryarray, i)), DBUSMENU_MENUITEM_SHORTCUT_SHIFT) == 0) {
+ if (g_strcmp0(g_value_get_string(value), DBUSMENU_MENUITEM_SHORTCUT_SHIFT) == 0) {
*modifier |= GDK_SHIFT_MASK;
continue;
}
- if (g_strcmp0(g_value_get_string(g_value_array_get_nth(entryarray, i)), DBUSMENU_MENUITEM_SHORTCUT_SUPER) == 0) {
+ if (g_strcmp0(g_value_get_string(value), DBUSMENU_MENUITEM_SHORTCUT_SUPER) == 0) {
*modifier |= GDK_SUPER_MASK;
continue;
}
@@ -336,7 +351,13 @@ dbusmenu_menuitem_property_get_shortcut (DbusmenuMenuitem * menuitem, guint * ke
GdkModifierType tempmod;
- gtk_accelerator_parse(g_value_get_string(g_value_array_get_nth(entryarray, entryarray->n_values - 1)), key, &tempmod);
+ GValue * accelval = g_value_array_get_nth(entryarray, entryarray->n_values - 1);
+ if (!G_VALUE_HOLDS_STRING(accelval)) {
+ *modifier = 0;
+ return;
+ }
+
+ gtk_accelerator_parse(g_value_get_string(accelval), key, &tempmod);
return;
}