Fix a corruption when you remove first joystick on Linux.
authorJørgen P. Tjernø <jorgen@valvesoftware.com>
Tue, 12 Feb 2013 11:47:29 -0800
changeset 6865670ebd20759d
parent 6864 97187387ad79
child 6866 e74a4b282450
Fix a corruption when you remove first joystick on Linux.

Fixes a bug where the joystick subsystem would get corrupted if you unplug the
first of multiple joysticks. Fixes bug 1714.


CR: saml
Xcode/SDLTest/SDLTest.xcodeproj/project.pbxproj
Xcode/TemplatesForXcodeTiger/SDL Application/English.lproj/InfoPlist.strings
Xcode/TemplatesForXcodeTiger/SDL Cocoa Application/English.lproj/InfoPlist.strings
Xcode/TemplatesForXcodeTiger/SDL OpenGL Application/English.lproj/InfoPlist.strings
src/joystick/linux/SDL_sysjoystick.c
     1.1 Binary file Xcode/TemplatesForXcodeTiger/SDL Application/English.lproj/InfoPlist.strings has changed
     2.1 Binary file Xcode/TemplatesForXcodeTiger/SDL Cocoa Application/English.lproj/InfoPlist.strings has changed
     3.1 Binary file Xcode/TemplatesForXcodeTiger/SDL OpenGL Application/English.lproj/InfoPlist.strings has changed
     4.1 --- a/src/joystick/linux/SDL_sysjoystick.c	Tue Feb 12 13:59:04 2013 -0300
     4.2 +++ b/src/joystick/linux/SDL_sysjoystick.c	Tue Feb 12 11:47:29 2013 -0800
     4.3 @@ -339,13 +339,12 @@
     4.4              }
     4.5              if (prev != NULL) {
     4.6                  prev->next = item->next;
     4.7 -                if (item == SDL_joylist_tail) {
     4.8 -                    SDL_joylist_tail = prev;
     4.9 -                }
    4.10              } else {
    4.11 -                SDL_assert(!SDL_joylist);
    4.12 -                SDL_assert(!SDL_joylist_tail);
    4.13 -                SDL_joylist = SDL_joylist_tail = NULL;
    4.14 +                SDL_assert(SDL_joylist == item);
    4.15 +                SDL_joylist = item->next;
    4.16 +            }
    4.17 +            if (item == SDL_joylist_tail) {
    4.18 +                SDL_joylist_tail = prev;
    4.19              }
    4.20              SDL_free(item->path);
    4.21              SDL_free(item->name);