[gtk+] x11: Declare variable for the inner loop



commit dbf85cc4dba2d659c65f18caadad256304a1f5d1
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Sep 9 16:05:15 2015 +0200

    x11: Declare variable for the inner loop
    
    Otherwise the outer loop control variable is messed up, and we end
    up with uninitialized axes if there were any more valuators after
    the XIKeyClass one.
    
    This bug was sneakily introduced by fdb9a8e14, many thanks to
    Carlos Soriano for helping spot the source of this bug.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=753431

 gdk/x11/gdkdevicemanager-xi2.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/gdk/x11/gdkdevicemanager-xi2.c b/gdk/x11/gdkdevicemanager-xi2.c
index e63c35b..2401ff1 100644
--- a/gdk/x11/gdkdevicemanager-xi2.c
+++ b/gdk/x11/gdkdevicemanager-xi2.c
@@ -214,11 +214,12 @@ translate_device_classes (GdkDisplay      *display,
         case XIKeyClass:
           {
             XIKeyClassInfo *key_info = (XIKeyClassInfo *) class_info;
+            gint j;
 
             _gdk_device_set_keys (device, key_info->num_keycodes);
 
-            for (i = 0; i < key_info->num_keycodes; i++)
-              gdk_device_set_key (device, i, key_info->keycodes[i], 0);
+            for (j = 0; j < key_info->num_keycodes; j++)
+              gdk_device_set_key (device, j, key_info->keycodes[j], 0);
           }
           break;
         case XIValuatorClass:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]