Commit 2a0bf33b authored by Carlos Garnacho's avatar Carlos Garnacho

gesture: Prevent against sequence cancellation within gtk_gesture_set_state()

Sequences may be cancelled within the ::sequence-state-changed handler, which
would change the points hashtable as it's being iterated in this function. So
iterate over a list of sequences and let the hashtable change freely.
parent 44a96019
......@@ -845,20 +845,21 @@ gboolean
gtk_gesture_set_state (GtkGesture *gesture,
GtkEventSequenceState state)
{
GdkEventSequence *sequence;
gboolean handled = FALSE;
GtkGesturePrivate *priv;
GHashTableIter iter;
GList *sequences, *l;
g_return_val_if_fail (GTK_IS_GESTURE (gesture), FALSE);
g_return_val_if_fail (state >= GTK_EVENT_SEQUENCE_NONE &&
state <= GTK_EVENT_SEQUENCE_DENIED, FALSE);
priv = gtk_gesture_get_instance_private (gesture);
g_hash_table_iter_init (&iter, priv->points);
sequences = g_hash_table_get_keys (priv->points);
while (g_hash_table_iter_next (&iter, (gpointer*) &sequence, NULL))
handled |= gtk_gesture_set_sequence_state (gesture, sequence, state);
for (l = sequences; l; l = l->next)
handled |= gtk_gesture_set_sequence_state (gesture, l->data, state);
g_list_free (sequences);
return handled;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment