Fixed bug 2953 - Crash due to a bad cleanup in the SDL_SYS_HapticQuit function
authorSam Lantinga <slouken@libsdl.org>
Sun, 14 Jun 2015 19:21:13 -0700
changeset 974055e88e3bc7cc
parent 9739 306e09b65660
child 9741 0ff5994253c2
Fixed bug 2953 - Crash due to a bad cleanup in the SDL_SYS_HapticQuit function

Technically this is caused by the haptic devices not being closed at quit time, which we need to fix anyway, but this is a bandaid for now.
src/haptic/SDL_haptic.c
src/haptic/SDL_syshaptic.h
src/haptic/darwin/SDL_syshaptic.c
src/haptic/dummy/SDL_syshaptic.c
src/haptic/linux/SDL_syshaptic.c
src/haptic/windows/SDL_windowshaptic.c
     1.1 --- a/src/haptic/SDL_haptic.c	Sun Jun 14 19:10:51 2015 -0700
     1.2 +++ b/src/haptic/SDL_haptic.c	Sun Jun 14 19:21:13 2015 -0700
     1.3 @@ -845,3 +845,4 @@
     1.4      return SDL_HapticStopEffect(haptic, haptic->rumble_id);
     1.5  }
     1.6  
     1.7 +/* vi: set ts=4 sw=4 expandtab: */
     2.1 --- a/src/haptic/SDL_syshaptic.h	Sun Jun 14 19:10:51 2015 -0700
     2.2 +++ b/src/haptic/SDL_syshaptic.h	Sun Jun 14 19:21:13 2015 -0700
     2.3 @@ -206,4 +206,3 @@
     2.4  #endif /* _SDL_syshaptic_h */
     2.5  
     2.6  /* vi: set ts=4 sw=4 expandtab: */
     2.7 -
     3.1 --- a/src/haptic/darwin/SDL_syshaptic.c	Sun Jun 14 19:10:51 2015 -0700
     3.2 +++ b/src/haptic/darwin/SDL_syshaptic.c	Sun Jun 14 19:21:13 2015 -0700
     3.3 @@ -683,7 +683,10 @@
     3.4          IOObjectRelease(item->dev);
     3.5          SDL_free(item);
     3.6      }
     3.7 +
     3.8      numhaptics = -1;
     3.9 +    SDL_hapticlist = NULL;
    3.10 +    SDL_hapticlist_tail = NULL;
    3.11  }
    3.12  
    3.13  
    3.14 @@ -1409,5 +1412,6 @@
    3.15      return 0;
    3.16  }
    3.17  
    3.18 +#endif /* SDL_HAPTIC_IOKIT */
    3.19  
    3.20 -#endif /* SDL_HAPTIC_IOKIT */
    3.21 +/* vi: set ts=4 sw=4 expandtab: */
     4.1 --- a/src/haptic/dummy/SDL_syshaptic.c	Sun Jun 14 19:10:51 2015 -0700
     4.2 +++ b/src/haptic/dummy/SDL_syshaptic.c	Sun Jun 14 19:21:13 2015 -0700
     4.3 @@ -182,3 +182,5 @@
     4.4  }
     4.5  
     4.6  #endif /* SDL_HAPTIC_DUMMY || SDL_HAPTIC_DISABLED */
     4.7 +
     4.8 +/* vi: set ts=4 sw=4 expandtab: */
     5.1 --- a/src/haptic/linux/SDL_syshaptic.c	Sun Jun 14 19:10:51 2015 -0700
     5.2 +++ b/src/haptic/linux/SDL_syshaptic.c	Sun Jun 14 19:21:13 2015 -0700
     5.3 @@ -1162,5 +1162,6 @@
     5.4      return 0;
     5.5  }
     5.6  
     5.7 +#endif /* SDL_HAPTIC_LINUX */
     5.8  
     5.9 -#endif /* SDL_HAPTIC_LINUX */
    5.10 +/* vi: set ts=4 sw=4 expandtab: */
     6.1 --- a/src/haptic/windows/SDL_windowshaptic.c	Sun Jun 14 19:10:51 2015 -0700
     6.2 +++ b/src/haptic/windows/SDL_windowshaptic.c	Sun Jun 14 19:21:13 2015 -0700
     6.3 @@ -272,6 +272,10 @@
     6.4  
     6.5      SDL_XINPUT_HapticQuit();
     6.6      SDL_DINPUT_HapticQuit();
     6.7 +
     6.8 +    numhaptics = 0;
     6.9 +    SDL_hapticlist = NULL;
    6.10 +    SDL_hapticlist_tail = NULL;
    6.11  }
    6.12  
    6.13  /*