[gtk+/gestures: 141/202] gesture: Prevent against sequence cancellation within gtk_gesture_set_state()
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gestures: 141/202] gesture: Prevent against sequence cancellation within gtk_gesture_set_state()
- Date: Fri, 23 May 2014 18:08:13 +0000 (UTC)
commit 2a0bf33bc9ce5ef7e717ee18ba614a6eddc6ec3a
Author: Carlos Garnacho <carlosg gnome org>
Date: Wed May 7 11:18:00 2014 +0200
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.
gtk/gtkgesture.c | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtkgesture.c b/gtk/gtkgesture.c
index 8a8de71..420ad9f 100644
--- a/gtk/gtkgesture.c
+++ b/gtk/gtkgesture.c
@@ -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;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]