Fixed crash when there was no mouse focus for some reason (iPhone bug?)
authorSam Lantinga <slouken@libsdl.org>
Thu, 21 Jan 2010 16:11:55 +0000
changeset 3689af25b5586af7
parent 3688 6512cba48440
child 3690 e431b888ac6c
Fixed crash when there was no mouse focus for some reason (iPhone bug?)
src/events/SDL_mouse.c
     1.1 --- a/src/events/SDL_mouse.c	Thu Jan 21 07:28:01 2010 +0000
     1.2 +++ b/src/events/SDL_mouse.c	Thu Jan 21 16:11:55 2010 +0000
     1.3 @@ -373,7 +373,7 @@
     1.4          event.proximity.cursor = mouse->current_end;
     1.5          event.proximity.type = type;
     1.6          /* FIXME: is this right? */
     1.7 -        event.proximity.windowID = mouse->focus->id;
     1.8 +        event.proximity.windowID = mouse->focus ? mouse->focus->id : 0;
     1.9          posted = (SDL_PushEvent(&event) > 0);
    1.10          if (type == SDL_PROXIMITYIN) {
    1.11              mouse->proximity = SDL_TRUE;
    1.12 @@ -479,7 +479,7 @@
    1.13          event.motion.cursor = mouse->current_end;
    1.14          event.motion.xrel = xrel;
    1.15          event.motion.yrel = yrel;
    1.16 -        event.motion.windowID = mouse->focus->id;
    1.17 +        event.motion.windowID = mouse->focus ? mouse->focus->id : 0;
    1.18          posted = (SDL_PushEvent(&event) > 0);
    1.19      }
    1.20      mouse->last_x = mouse->x;
    1.21 @@ -532,7 +532,7 @@
    1.22          event.button.button = button;
    1.23          event.button.x = mouse->x;
    1.24          event.button.y = mouse->y;
    1.25 -        event.button.windowID = mouse->focus->id;
    1.26 +        event.button.windowID = mouse->focus ? mouse->focus->id : 0;
    1.27          posted = (SDL_PushEvent(&event) > 0);
    1.28      }
    1.29      return posted;
    1.30 @@ -556,7 +556,7 @@
    1.31          event.wheel.which = (Uint8) index;
    1.32          event.wheel.x = x;
    1.33          event.wheel.y = y;
    1.34 -        event.wheel.windowID = mouse->focus->id;
    1.35 +        event.wheel.windowID = mouse->focus ? mouse->focus->id : 0;
    1.36          posted = (SDL_PushEvent(&event) > 0);
    1.37      }
    1.38      return posted;