diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2010-06-20 11:37:47 +0000 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2010-06-20 11:37:47 +0000 |
| commit | 0f0fc5f1987e879ddfffdb0de9214987157eedc2 (patch) | |
| tree | d822459d452f3e7f1d7f49df867363eb01023be5 /src/FileAllocationCommand.cc | |
| parent | cb4e25e4b4a2cfa6349a25586a44c932022e6841 (diff) | |
2010-06-20 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
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
Diffstat (limited to 'src/FileAllocationCommand.cc')
| -rw-r--r-- | src/FileAllocationCommand.cc | 13 |
1 files changed, 5 insertions, 8 deletions
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<Command*> commands; - try { - _fileAllocationEntry->prepareForNextAction(commands, getDownloadEngine()); - } catch(RecoverableException& e) { - std::for_each(commands.begin(), commands.end(), Deleter()); - throw; - } - getDownloadEngine()->addCommand(commands); + std::vector<Command*>* commands = new std::vector<Command*>(); + auto_delete_container<std::vector<Command*> > commandsDel(commands); + _fileAllocationEntry->prepareForNextAction(*commands, getDownloadEngine()); + getDownloadEngine()->addCommand(*commands); + commands->clear(); getDownloadEngine()->setNoWait(true); return true; } else { |
