From e2bf627b17c5a25692a5a4d530e1774d95cc6a46 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sun, 2 Sep 2012 17:43:26 +0900 Subject: [PATCH] Ensure that num of commands is 0 before processing tracker response --- src/TrackerWatcherCommand.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/TrackerWatcherCommand.cc b/src/TrackerWatcherCommand.cc index d1264480..ac324871 100644 --- a/src/TrackerWatcherCommand.cc +++ b/src/TrackerWatcherCommand.cc @@ -112,7 +112,12 @@ bool TrackerWatcherCommand::execute() { A2_LOG_ERROR_EX(EX_EXCEPTION_CAUGHT, ex); } } - } else if(trackerRequestGroup_->downloadFinished()){ + } else if(trackerRequestGroup_->getNumCommand() == 0 && + trackerRequestGroup_->downloadFinished()){ + // We really want to make sure that tracker request has finished + // by checking getNumCommand() == 0. Because we reset + // trackerRequestGroup_, if it is still used in other Command, we + // will get Segmentation fault. try { std::string trackerResponse = getTrackerResponse(trackerRequestGroup_);