Menu: Typecheck before dereferencing to get ->priv

This commit is contained in:
Daniel Boles 2018-04-17 19:51:53 +01:00
parent 2a7e5d5137
commit 24953ab1be

View File

@ -2212,12 +2212,14 @@ gtk_menu_popdown (GtkMenu *menu)
GtkWidget*
gtk_menu_get_active (GtkMenu *menu)
{
GtkMenuPrivate *priv = menu->priv;
GtkMenuPrivate *priv;
GtkWidget *child;
GList *children;
g_return_val_if_fail (GTK_IS_MENU (menu), NULL);
priv = menu->priv;
if (!priv->old_active_menu_item)
{
child = NULL;
@ -2254,12 +2256,14 @@ void
gtk_menu_set_active (GtkMenu *menu,
guint index)
{
GtkMenuPrivate *priv = menu->priv;
GtkMenuPrivate *priv;
GtkWidget *child;
GList *tmp_list;
g_return_if_fail (GTK_IS_MENU (menu));
priv = menu->priv;
tmp_list = g_list_nth (GTK_MENU_SHELL (menu)->priv->children, index);
if (tmp_list)
{
@ -2291,9 +2295,12 @@ void
gtk_menu_set_accel_group (GtkMenu *menu,
GtkAccelGroup *accel_group)
{
GtkMenuPrivate *priv = menu->priv;
GtkMenuPrivate *priv;
g_return_if_fail (GTK_IS_MENU (menu));
priv = menu->priv;
if (priv->accel_group != accel_group)
{
if (priv->accel_group)
@ -2371,9 +2378,12 @@ void
gtk_menu_set_accel_path (GtkMenu *menu,
const gchar *accel_path)
{
GtkMenuPrivate *priv = menu->priv;
GtkMenuPrivate *priv;
g_return_if_fail (GTK_IS_MENU (menu));
priv = menu->priv;
if (accel_path)
g_return_if_fail (accel_path[0] == '<' && strchr (accel_path, '/')); /* simplistic check */
@ -4626,10 +4636,12 @@ void
gtk_menu_set_monitor (GtkMenu *menu,
gint monitor_num)
{
GtkMenuPrivate *priv = menu->priv;
GtkMenuPrivate *priv;
g_return_if_fail (GTK_IS_MENU (menu));
priv = menu->priv;
if (priv->monitor_num != monitor_num)
{
priv->monitor_num = monitor_num;
@ -4752,13 +4764,14 @@ void
gtk_menu_set_reserve_toggle_size (GtkMenu *menu,
gboolean reserve_toggle_size)
{
GtkMenuPrivate *priv = menu->priv;
GtkMenuPrivate *priv;
gboolean no_toggle_size;
g_return_if_fail (GTK_IS_MENU (menu));
no_toggle_size = !reserve_toggle_size;
priv = menu->priv;
no_toggle_size = !reserve_toggle_size;
if (priv->no_toggle_size != no_toggle_size)
{
priv->no_toggle_size = no_toggle_size;