pingus-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SoundResMgr (Was: Another status report)


From: Gervase Lam
Subject: SoundResMgr (Was: Another status report)
Date: Tue, 8 Apr 2003 00:16:52 +0100

> Date: 06 Apr 2003 19:50:59 +0200
> From: Ingo Ruhnke <address@hidden>
> Subject: Re: Another status report

> Gervase Lam <address@hidden> writes:
>  
>
> > How sound management was changed recently by introducing the
> > SoundResMgr class.  Within it is the line:
>
> > CL_SoundBuffer* buffer = new CL_SoundBuffer (new CL_Sample(filename,
> > NULL), true);
>
> > Where or what deletes buffer?  When does it happen?
>
> It doesn't get deleted, it stays until the application exits, but
> since we have only a handfull of sounds, that isn't a problem.

Wouldn't it be better for SoundResMgr to have a destructor like:

SoundResMgr::~SoundResMgr()
{
  for (SoundMap::iterator i = sound_map.begin(); i != sound_map.end(); ++i)
    delete i.second;
}

Or am I missing where the deletes already occur?

The 'new CL_Sample' shouldn't need a delete as the 'true' flag means that 
it gets destroyed when CL_SoundBuffer is destroyed.

Thanks,
Gervase.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]