Revert "Add destructor for SoundTrack/MusicTrack (and explicitly define move constructor to prevent double-free)"

This reverts commit 2f760af439.
This commit is contained in:
leo60228
2020-06-07 15:49:18 -04:00
committed by Ethan Lee
parent 098fb77611
commit d193caac98
3 changed files with 62 additions and 99 deletions

View File

@@ -8,9 +8,6 @@ class MusicTrack
public:
MusicTrack(const char* fileName);
MusicTrack(SDL_RWops *rw);
MusicTrack(MusicTrack&& moved);
MusicTrack& operator=(const MusicTrack& other) = default;
~MusicTrack();
Mix_Music *m_music;
bool m_isValid;
};
@@ -19,12 +16,7 @@ class SoundTrack
{
public:
SoundTrack(const char* fileName);
SoundTrack(SoundTrack&& moved);
SoundTrack& operator=(const SoundTrack& other) = default;
SoundTrack() = default;
~SoundTrack();
Mix_Chunk *sound;
bool isValid = false;
};
class SoundSystem
@@ -34,14 +26,4 @@ public:
void playMusic(MusicTrack* music);
};
// polyfill of std::move
template<typename T> struct remove_reference {typedef T type;};
template<typename T> struct remove_reference<T&> {typedef T type;};
template<typename T> struct remove_reference<T&&> {typedef T type;};
template<typename T>
typename remove_reference<T>::type&& move(T&& t) {
return static_cast<typename remove_reference<T>::type&&>(t);
}
#endif /* SOUNDSYSTEM_H */