Fixed bug 2430 - Missing initialization of the variable 'centroid' inside SDL_GestureAddTouch
authorSam Lantinga <slouken@libsdl.org>
Thu, 06 Mar 2014 20:02:17 -0800
changeset 8296 cb13016bf07b
parent 8295 56f7e38ff0bc
child 8297 be2102f000d0
Fixed bug 2430 - Missing initialization of the variable 'centroid' inside SDL_GestureAddTouch

klose

File: SDL_gesture.c
Method: SDL_GestureAddTouch

When a new SDL_GestureTouch element is added to the global SDL_gestureTouch array the variable 'centroid' of the new element is not initialized.

The problem is that this variable is read isndie SDL_GestureProcessEvent when a SDL_FINGERDOWN event occurs.
src/events/SDL_gesture.c
--- a/src/events/SDL_gesture.c	Mon Mar 03 21:25:16 2014 -0500
+++ b/src/events/SDL_gesture.c	Thu Mar 06 20:02:17 2014 -0800
@@ -418,13 +418,8 @@
 
     SDL_gestureTouch = gestureTouch;
 
-    SDL_gestureTouch[SDL_numGestureTouches].numDownFingers = 0;
+    SDL_zero(SDL_gestureTouch[SDL_numGestureTouches]);
     SDL_gestureTouch[SDL_numGestureTouches].id = touchId;
-
-    SDL_gestureTouch[SDL_numGestureTouches].numDollarTemplates = 0;
-
-    SDL_gestureTouch[SDL_numGestureTouches].recording = SDL_FALSE;
-
     SDL_numGestureTouches++;
     return 0;
 }