| Summary: | Loop indexing and event union errors in SDL_gesture.c | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Lasse Öörni <loorni> |
| Component: | events | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | ||
| Version: | 2.0.3 | ||
| Hardware: | All | ||
| OS: | All | ||
Fixed, thanks! https://hg.libsdl.org/SDL/rev/fee2f7e242a1 Thanks for the quick response! I looked at the hg repo, there's still one line which is using the wrong index variable in SDL_SaveDollarTemplate():
if (touch->dollarTemplate[i].hash == gestureId) {
Fixed, thanks! |
While enabling $1 gesture support in the Urho3D engine which uses SDL2 I detected some errors in the gesture code in SDL_gesture.c: - In the function SDL_SaveAllDollarTemplates() the following line should use index variable j instead of i: rtrn += SaveTemplate(&touch->dollarTemplate[i], dst); - In the function SDL_SaveDollarTemplate() the following code should use index variable j instead of i: if (touch->dollarTemplate[i].hash == gestureId) { return SaveTemplate(&touch->dollarTemplate[i], dst); - In the function SDL_SendGestureDollar() the x & y coordinates are being written to the mgesture structure, which results in garbage due to dgesture and mgesture being different data structures inside the union. The coordinates should be written to dgesture.x & dgesture.y respectively