Added terminate() to the MusicEngine and publicized
the iMuse implementation. This allows the termination sequence to be done BEFORE object destruction, so that the destructor is not making calls that may not be appropriate during object destruction. (Virtual functions were the concern, although I'm not sure any of that was happening anyway. Oh well, better to be safe than sorry.) I implemented an empty terminate() in the base class, but the other MusicEngine derivatives may have stuff in their destructors that should be moved to this method. I didn't check. svn-id: r10452
This commit is contained in:
parent
1d40ce68c2
commit
044bcd5430
5 changed files with 7 additions and 6 deletions
|
@ -69,10 +69,6 @@ _snm_trigger_index(0)
|
|||
memset(_active_notes,0,sizeof(_active_notes));
|
||||
}
|
||||
|
||||
IMuseInternal::~IMuseInternal() {
|
||||
terminate();
|
||||
}
|
||||
|
||||
byte *IMuseInternal::findStartOfSound(int sound) {
|
||||
byte *ptr = NULL;
|
||||
int32 size, pos;
|
||||
|
@ -1783,6 +1779,7 @@ int32 IMuse::doCommand (int numargs, int args[]) { in(); int32 ret = _target->do
|
|||
int IMuse::clear_queue() { in(); int ret = _target->clear_queue(); out(); return ret; }
|
||||
void IMuse::setBase(byte **base) { in(); _target->setBase(base); out(); }
|
||||
uint32 IMuse::property(int prop, uint32 value) { in(); uint32 ret = _target->property(prop, value); out(); return ret; }
|
||||
void IMuse::terminate() { in(); _target->terminate(); out(); }
|
||||
|
||||
// The IMuse::create method provides a front-end factory
|
||||
// for creating IMuseInternal without exposing that class
|
||||
|
|
|
@ -74,6 +74,7 @@ public:
|
|||
int clear_queue();
|
||||
void setBase(byte **base);
|
||||
uint32 property(int prop, uint32 value);
|
||||
void terminate();
|
||||
|
||||
// Factory methods
|
||||
static IMuse *create(OSystem *syst, SoundMixer *mixer, MidiDriver *midi);
|
||||
|
|
|
@ -440,7 +440,6 @@ protected:
|
|||
|
||||
public:
|
||||
IMuseInternal();
|
||||
~IMuseInternal();
|
||||
|
||||
int initialize(OSystem *syst, SoundMixer *mixer, MidiDriver *midi);
|
||||
void reallocateMidiChannels(MidiDriver *midi);
|
||||
|
|
|
@ -37,6 +37,7 @@ public:
|
|||
virtual void stopAllSounds() = 0;
|
||||
virtual int getSoundStatus(int sound) const = 0;
|
||||
// virtual int getMusicTimer() const = 0;
|
||||
virtual void terminate() {}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -824,7 +824,10 @@ Scumm::~Scumm () {
|
|||
delete _confirmExitDialog;
|
||||
|
||||
delete _sound;
|
||||
if (_musicEngine) {
|
||||
_musicEngine->terminate();
|
||||
delete _musicEngine;
|
||||
}
|
||||
free(_languageBuffer);
|
||||
free(_audioNames);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue