src/events/SDL_mouse.c
changeset 2718 abacf2555bb4
parent 2712 c4e697245676
child 2725 6ce6d56b63bf
     1.1 --- a/src/events/SDL_mouse.c	Mon Aug 25 17:34:58 2008 +0000
     1.2 +++ b/src/events/SDL_mouse.c	Mon Aug 25 18:02:14 2008 +0000
     1.3 @@ -116,8 +116,8 @@
     1.4      /* we're setting the mouse properties */
     1.5      length = 0;
     1.6      length = SDL_strlen(name);
     1.7 -    SDL_mice[index]->name = SDL_malloc((length + 1) * sizeof(char));
     1.8 -    SDL_strlcpy(SDL_mice[index]->name, name, length);
     1.9 +    SDL_mice[index]->name = SDL_malloc((length + 2) * sizeof(char));
    1.10 +    SDL_strlcpy(SDL_mice[index]->name, name, length+1);
    1.11      SDL_mice[index]->pressure_max = pressure_max;
    1.12      SDL_mice[index]->pressure_min = pressure_min;
    1.13      SDL_mice[index]->cursor_shown = SDL_TRUE;
    1.14 @@ -512,6 +512,10 @@
    1.15          mouse->buttonstate |= SDL_BUTTON(button);
    1.16          break;
    1.17      case SDL_RELEASED:
    1.18 +        if(!(mouse->buttonstate & SDL_BUTTON(button))) {
    1.19 +            /* Ignore this event, no state change */
    1.20 +            return 0;
    1.21 +        }
    1.22          type = SDL_MOUSEBUTTONUP;
    1.23          mouse->buttonstate &= ~SDL_BUTTON(button);
    1.24          break;