X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Fpackage%2FRoot.cxx;h=785076530feed194e611c75e4edbe830d684decc;hb=a3f1bb546fec72b07f11f69934e6894696fea57a;hp=7f2e8ea80560bcbd576ee71b1742956151596324;hpb=27baafab0dd8c06b50e6c5024663ab0fc277ee6c;p=simgear.git diff --git a/simgear/package/Root.cxx b/simgear/package/Root.cxx index 7f2e8ea8..78507653 100644 --- a/simgear/package/Root.cxx +++ b/simgear/package/Root.cxx @@ -226,6 +226,20 @@ void Root::makeHTTPRequest(HTTP::Request *req) d->httpPendingRequests.push_back(req); } +void Root::cancelHTTPRequest(HTTP::Request *req, const std::string &reason) +{ + if (d->http) { + d->http->cancelRequest(req, reason); + } + + std::deque::iterator it = std::find(d->httpPendingRequests.begin(), + d->httpPendingRequests.end(), + req); + if (it != d->httpPendingRequests.end()) { + d->httpPendingRequests.erase(it); + } +} + Root::Root(const SGPath& aPath, const std::string& aVersion) : d(new RootPrivate) { @@ -532,8 +546,10 @@ void Root::catalogRefreshStatus(CatalogRef aCat, Delegate::StatusCode aReason) } // and remove it from the active collection - d->catalogs.erase(catIt); - } + if (catIt != d->catalogs.end()) { + d->catalogs.erase(catIt); + } + } // of catalog has errors case if (d->refreshing.empty()) { d->fireRefreshStatus(CatalogRef(), Delegate::STATUS_REFRESHED);