From 0f0fc5f1987e879ddfffdb0de9214987157eedc2 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sun, 20 Jun 2010 11:37:47 +0000 Subject: 2010-06-20 Tatsuhiro Tsujikawa Use auto_delete_container to delete created Command when exception is thrown rather than deleting them in catch block. * src/AbstractCommand.cc * src/CheckIntegrityCommand.cc * src/DHTSetup.cc * src/FileAllocationCommand.cc * src/TrackerWatcherCommand.cc * src/a2functional.h --- src/FileAllocationCommand.cc | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'src/FileAllocationCommand.cc') diff --git a/src/FileAllocationCommand.cc b/src/FileAllocationCommand.cc index 04bcc377..eeb85a96 100644 --- a/src/FileAllocationCommand.cc +++ b/src/FileAllocationCommand.cc @@ -76,14 +76,11 @@ bool FileAllocationCommand::executeInternal() } getDownloadEngine()->getFileAllocationMan()->dropPickedEntry(); - std::vector commands; - try { - _fileAllocationEntry->prepareForNextAction(commands, getDownloadEngine()); - } catch(RecoverableException& e) { - std::for_each(commands.begin(), commands.end(), Deleter()); - throw; - } - getDownloadEngine()->addCommand(commands); + std::vector* commands = new std::vector(); + auto_delete_container > commandsDel(commands); + _fileAllocationEntry->prepareForNextAction(*commands, getDownloadEngine()); + getDownloadEngine()->addCommand(*commands); + commands->clear(); getDownloadEngine()->setNoWait(true); return true; } else { -- cgit