Return state_set directly if there is no parent.

Bug #592403. Return state_set directly if there is no parent. Fix crash.
This commit is contained in:
Li Yuan 2009-08-21 15:29:51 +08:00
parent e0a1e78a5a
commit 0780a4975b

View File

@ -251,16 +251,18 @@ gail_menu_item_ref_state_set (AtkObject *obj)
menu_item = atk_object_get_parent (obj);
if (!GTK_IS_MENU_ITEM (GTK_ACCESSIBLE (menu_item)->widget))
return state_set;
parent_state_set = atk_object_ref_state_set (menu_item);
if (!atk_state_set_contains_state (parent_state_set, ATK_STATE_SELECTED))
if (menu_item)
{
atk_state_set_remove_state (state_set, ATK_STATE_FOCUSED);
atk_state_set_remove_state (state_set, ATK_STATE_SHOWING);
}
if (!GTK_IS_MENU_ITEM (GTK_ACCESSIBLE (menu_item)->widget))
return state_set;
parent_state_set = atk_object_ref_state_set (menu_item);
if (!atk_state_set_contains_state (parent_state_set, ATK_STATE_SELECTED))
{
atk_state_set_remove_state (state_set, ATK_STATE_FOCUSED);
atk_state_set_remove_state (state_set, ATK_STATE_SHOWING);
}
}
return state_set;
}