Fixed some memory leaks. Only one was mine ;P

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7392 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Jordan Woyak
2011-03-22 07:27:23 +00:00
parent 017735b9ff
commit f8620fcd0b
18 changed files with 89 additions and 99 deletions

View File

@ -447,7 +447,7 @@ ControllerInterface::Device* ControllerInterface::FindDevice(const ControllerInt
ControllerInterface::Device::Control* ControllerInterface::InputReference::Detect(const unsigned int ms, Device* const device)
{
unsigned int time = 0;
bool* const states = new bool[device->Inputs().size()];
std::vector<bool> states(device->Inputs().size());
if (device->Inputs().size() == 0)
return NULL;
@ -457,14 +457,14 @@ ControllerInterface::Device::Control* ControllerInterface::InputReference::Detec
std::vector<Device::Input*>::const_iterator
i = device->Inputs().begin(),
e = device->Inputs().end();
for (bool* state=states; i != e; ++i)
for (std::vector<bool>::iterator state = states.begin(); i != e; ++i)
*state++ = ((*i)->GetState() > INPUT_DETECT_THRESHOLD);
while (time < ms)
{
device->UpdateInput();
i = device->Inputs().begin();
for (bool* state=states; i != e; ++i,++state)
for (std::vector<bool>::iterator state = states.begin(); i != e; ++i,++state)
{
// detected an input
if ((*i)->IsDetectable() && (*i)->GetState() > INPUT_DETECT_THRESHOLD)
@ -480,8 +480,6 @@ ControllerInterface::Device::Control* ControllerInterface::InputReference::Detec
Common::SleepCurrentThread(10); time += 10;
}
delete[] states;
// no input was detected
return NULL;
}