[SVN] r3836 - in branches/gsoc2008_force_feedback/src/haptic: . darwin linux win32
svn-owner at libsdl.org
svn-owner at libsdl.org
Thu Jul 31 02:45:28 PDT 2008
Author: bobbens
Date: 2008-07-31 02:45:27 -0700 (Thu, 31 Jul 2008)
New Revision: 3836
Modified:
branches/gsoc2008_force_feedback/src/haptic/SDL_haptic.c
branches/gsoc2008_force_feedback/src/haptic/darwin/SDL_syshaptic.c
branches/gsoc2008_force_feedback/src/haptic/linux/SDL_syshaptic.c
branches/gsoc2008_force_feedback/src/haptic/win32/SDL_syshaptic.c
Log:
Correctness patch, it's up to the SDL_haptic.c to clean up effects, not SDL_syshaptic.c.
Modified: branches/gsoc2008_force_feedback/src/haptic/SDL_haptic.c
===================================================================
--- branches/gsoc2008_force_feedback/src/haptic/SDL_haptic.c 2008-07-31 09:02:43 UTC (rev 3835)
+++ branches/gsoc2008_force_feedback/src/haptic/SDL_haptic.c 2008-07-31 09:45:27 UTC (rev 3836)
@@ -322,6 +322,7 @@
/* Remove from the list */
for (i = 0; SDL_haptics[i]; ++i) {
if (haptic == SDL_haptics[i]) {
+ SDL_haptics[i] = NULL;
SDL_memcpy(&SDL_haptics[i], &SDL_haptics[i + 1],
(SDL_numhaptics - i) * sizeof(haptic));
break;
Modified: branches/gsoc2008_force_feedback/src/haptic/darwin/SDL_syshaptic.c
===================================================================
--- branches/gsoc2008_force_feedback/src/haptic/darwin/SDL_syshaptic.c 2008-07-31 09:02:43 UTC (rev 3835)
+++ branches/gsoc2008_force_feedback/src/haptic/darwin/SDL_syshaptic.c 2008-07-31 09:45:27 UTC (rev 3836)
@@ -470,19 +470,11 @@
void
SDL_SYS_HapticClose(SDL_Haptic * haptic)
{
- int i;
-
if (haptic->hwdata) {
- /* Free the effects. */
- for (i=0; i<haptic->neffects; i++) {
- if (haptic->effects[i].hweffect != NULL) {
- SDL_SYS_HapticFreeFFEFFECT(&haptic->effects[i].hweffect->effect,
- haptic->effects[i].effect.type);
- SDL_free(haptic->effects[i].hweffect);
- }
- }
+ /* Free Effects. */
SDL_free(haptic->effects);
+ haptic->effects = NULL;
haptic->neffects = 0;
/* Clean up */
Modified: branches/gsoc2008_force_feedback/src/haptic/linux/SDL_syshaptic.c
===================================================================
--- branches/gsoc2008_force_feedback/src/haptic/linux/SDL_syshaptic.c 2008-07-31 09:02:43 UTC (rev 3835)
+++ branches/gsoc2008_force_feedback/src/haptic/linux/SDL_syshaptic.c 2008-07-31 09:45:27 UTC (rev 3836)
@@ -423,12 +423,17 @@
{
if (haptic->hwdata) {
+ /* Free effects. */
+ SDL_free(haptic->effects);
+ haptic->effects = NULL;
+ haptic->neffects = 0;
+
/* Clean up */
close(haptic->hwdata->fd);
/* Free */
- SDL_free(haptic->hwdata);
- SDL_free(haptic->effects);
+ SDL_free(haptic->hwdata);
+ haptic->hwdata = NULL;
}
/* Clear the rest. */
Modified: branches/gsoc2008_force_feedback/src/haptic/win32/SDL_syshaptic.c
===================================================================
--- branches/gsoc2008_force_feedback/src/haptic/win32/SDL_syshaptic.c 2008-07-31 09:02:43 UTC (rev 3835)
+++ branches/gsoc2008_force_feedback/src/haptic/win32/SDL_syshaptic.c 2008-07-31 09:45:27 UTC (rev 3836)
@@ -361,9 +361,6 @@
return 0;
/* Error handling */
-open_err:
- IDirectInputDevice_Release(device);
- goto creat_err;
acquire_err:
IDirectInputDevice2_Unacquire(haptic->hwdata->device);
query_err:
@@ -435,19 +432,11 @@
void
SDL_SYS_HapticClose(SDL_Haptic * haptic)
{
- int i;
-
if (haptic->hwdata) {
- /* Free the effects. */
- for (i=0; i<haptic->neffects; i++) {
- if (haptic->effects[i].hweffect != NULL) {
- SDL_SYS_HapticFreeFFEFFECT( &haptic->effects[i].hweffect->effect,
- haptic->effects[i].effect.type );
- SDL_free(haptic->effects[i].hweffect);
- }
- }
+ /* Free effects. */
SDL_free(haptic->effects);
+ haptic->effects = NULL;
haptic->neffects = 0;
/* Clean up */
More information about the commits
mailing list