Issue #9061: Fix no success notification for empty download queue issue

This commit is contained in:
pandamicro 2014-11-10 16:51:41 +08:00
parent ead867559c
commit e167f0889b
1 changed files with 30 additions and 31 deletions

View File

@ -471,13 +471,11 @@ void Downloader::batchDownloadAsync(const DownloadUnits &units, const std::strin
void Downloader::batchDownloadSync(const DownloadUnits &units, const std::string &batchId/* = ""*/)
{
if (units.size() == 0)
{
return;
}
// Make sure downloader won't be released
std::weak_ptr<Downloader> ptr = shared_from_this();
if (units.size() != 0)
{
// Test server download resuming support with the first unit
_supportResuming = false;
CURL *header = curl_easy_init();
@ -512,6 +510,7 @@ void Downloader::batchDownloadSync(const DownloadUnits &units, const std::string
{
groupBatchDownload(group);
}
}
Director::getInstance()->getScheduler()->performFunctionInCocosThread([ptr, batchId]{
if (!ptr.expired()) {