diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-02-18 22:22:56 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-02-18 23:10:50 +0300 |
commit | 9fbbdc2ce4d7d7a9551d59bb45f0d95ac33c4a2a (patch) | |
tree | 44086ebd4f4d66bc28856ffbf15a7b6a74dbeeb1 | |
parent | 8b3be62d63cac102aa8b0d30feeb1751b64afb7a (diff) | |
download | plus-9fbbdc2ce4d7d7a9551d59bb45f0d95ac33c4a2a.tar.gz plus-9fbbdc2ce4d7d7a9551d59bb45f0d95ac33c4a2a.tar.bz2 plus-9fbbdc2ce4d7d7a9551d59bb45f0d95ac33c4a2a.tar.xz plus-9fbbdc2ce4d7d7a9551d59bb45f0d95ac33c4a2a.zip |
Fix memory corruption with SDL_mixer < 1.2.12 (SDL 1.2).
-rw-r--r-- | src/resources/sdlmusic.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/resources/sdlmusic.cpp b/src/resources/sdlmusic.cpp index c2a51aaf4..964cab507 100644 --- a/src/resources/sdlmusic.cpp +++ b/src/resources/sdlmusic.cpp @@ -24,6 +24,13 @@ #include "debug.h" +#define SDL_MIXER_COMPILEDVERSION \ + SDL_VERSIONNUM(SDL_MIXER_MAJOR_VERSION, \ + SDL_MIXER_MINOR_VERSION, SDL_MIXER_PATCHLEVEL) + +#define SDL_MIXER_VERSION_ATLEAST(X, Y, Z) \ + (SDL_MIXER_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z)) + SDLMusic::SDLMusic(Mix_Music *const music, SDL_RWops *const rw, const std::string &name) : @@ -38,11 +45,13 @@ SDLMusic::~SDLMusic() { Mix_FreeMusic(mMusic); #ifndef USE_SDL2 +#if SDL_MIXER_VERSION_ATLEAST(1, 2, 12) if (mRw) { SDL_RWclose(mRw); mRw = nullptr; } +#endif // SDL_MIXER_VERSION_ATLEAST(1, 2, 12) #endif // USE_SDL2 } |