[Scummvm-cvs-logs] CVS: scummvm/scumm imuse.cpp,2.95,2.96 imuse.h,1.45,1.46 imuse_internal.h,2.21,2.22 music.h,2.5,2.6 scummvm.cpp,2.405,2.406
Jamieson Christian
jamieson630 at users.sourceforge.net
Sat Sep 27 17:05:02 CEST 2003
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv22168
Modified Files:
imuse.cpp imuse.h imuse_internal.h music.h scummvm.cpp
Log Message:
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.
Index: imuse.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse.cpp,v
retrieving revision 2.95
retrieving revision 2.96
diff -u -d -r2.95 -r2.96
--- imuse.cpp 17 Sep 2003 22:40:58 -0000 2.95
+++ imuse.cpp 28 Sep 2003 00:03:23 -0000 2.96
@@ -69,10 +69,6 @@
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 @@
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
Index: imuse.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse.h,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- imuse.h 8 Sep 2003 17:06:44 -0000 1.45
+++ imuse.h 28 Sep 2003 00:03:23 -0000 1.46
@@ -74,6 +74,7 @@
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);
Index: imuse_internal.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_internal.h,v
retrieving revision 2.21
retrieving revision 2.22
diff -u -d -r2.21 -r2.22
--- imuse_internal.h 21 Sep 2003 18:15:28 -0000 2.21
+++ imuse_internal.h 28 Sep 2003 00:03:23 -0000 2.22
@@ -440,7 +440,6 @@
public:
IMuseInternal();
- ~IMuseInternal();
int initialize(OSystem *syst, SoundMixer *mixer, MidiDriver *midi);
void reallocateMidiChannels(MidiDriver *midi);
Index: music.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/music.h,v
retrieving revision 2.5
retrieving revision 2.6
diff -u -d -r2.5 -r2.6
--- music.h 8 Sep 2003 17:06:44 -0000 2.5
+++ music.h 28 Sep 2003 00:03:24 -0000 2.6
@@ -37,6 +37,7 @@
virtual void stopAllSounds() = 0;
virtual int getSoundStatus(int sound) const = 0;
// virtual int getMusicTimer() const = 0;
+ virtual void terminate() {}
};
#endif
Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scummvm.cpp,v
retrieving revision 2.405
retrieving revision 2.406
diff -u -d -r2.405 -r2.406
--- scummvm.cpp 27 Sep 2003 20:31:19 -0000 2.405
+++ scummvm.cpp 28 Sep 2003 00:03:24 -0000 2.406
@@ -824,7 +824,10 @@
delete _confirmExitDialog;
delete _sound;
- delete _musicEngine;
+ if (_musicEngine) {
+ _musicEngine->terminate();
+ delete _musicEngine;
+ }
free(_languageBuffer);
free(_audioNames);
More information about the Scummvm-git-logs
mailing list