summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2015-07-23 14:26:25 +0200
committerMatthias Clasen <mclasen@redhat.com>2015-07-30 22:37:53 -0400
commit65f7fb04ad3cd59ac87ac13a3a59ac18c65c610c (patch)
tree6d749944b77fe87780cb46f0d3bcfd7a560e4f1e
parent2550c6a4db0e5427d5c793eb1757acd51642471c (diff)
downloadgtk+-65f7fb04ad3cd59ac87ac13a3a59ac18c65c610c.tar.gz
GtkMenuButton: explicitly protect against recursion
The visibility toggling happening on ::click() relied implicitly on the popover animation, but breaks on disabled animations. The recursion happening within gtk_toggle_button_set_active() (which triggers ::clicked when changing state) makes this vfunc to run again, inverting the visibility of the popover in result. Fix this by explicitly checking about recursion, we want the button to be toggled to the right state, but we don't want the callback running again. https://bugzilla.gnome.org/show_bug.cgi?id=752577
-rw-r--r--gtk/gtkmenubutton.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gtk/gtkmenubutton.c b/gtk/gtkmenubutton.c
index 2126087dd4..fad5cb6432 100644
--- a/gtk/gtkmenubutton.c
+++ b/gtk/gtkmenubutton.c
@@ -133,6 +133,7 @@ struct _GtkMenuButtonPrivate
GtkArrowType arrow_type;
gboolean use_popover;
guint press_handled : 1;
+ guint in_click : 1;
};
enum
@@ -429,6 +430,11 @@ gtk_menu_button_clicked (GtkButton *button)
GtkMenuButtonPrivate *priv = menu_button->priv;
gboolean active;
+ if (priv->in_click)
+ return;
+
+ priv->in_click = TRUE;
+
if (priv->menu)
{
active = !gtk_widget_get_visible (priv->menu);
@@ -464,6 +470,7 @@ gtk_menu_button_clicked (GtkButton *button)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), active);
gtk_toggle_button_toggled (GTK_TOGGLE_BUTTON (button));
+ priv->in_click = FALSE;
}
static void