Catalogs: fix ownership of new Catalogs
When doing the initial download of a Catalog, ensure we still keep an owning ref to it.
This commit is contained in:
parent
da53e8fb1b
commit
15c6f73136
@ -722,12 +722,6 @@ void Root::catalogRefreshStatus(CatalogRef aCat, Delegate::StatusCode aReason)
|
|||||||
auto catIt = d->catalogs.find(aCat->id());
|
auto catIt = d->catalogs.find(aCat->id());
|
||||||
d->fireRefreshStatus(aCat, aReason);
|
d->fireRefreshStatus(aCat, aReason);
|
||||||
|
|
||||||
if (aReason == Delegate::STATUS_IN_PROGRESS) {
|
|
||||||
d->refreshing.insert(aCat);
|
|
||||||
} else {
|
|
||||||
d->refreshing.erase(aCat);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (aCat->isUserEnabled() &&
|
if (aCat->isUserEnabled() &&
|
||||||
(aReason == Delegate::STATUS_REFRESHED) &&
|
(aReason == Delegate::STATUS_REFRESHED) &&
|
||||||
(catIt == d->catalogs.end()))
|
(catIt == d->catalogs.end()))
|
||||||
@ -761,6 +755,17 @@ void Root::catalogRefreshStatus(CatalogRef aCat, Delegate::StatusCode aReason)
|
|||||||
}
|
}
|
||||||
} // of catalog is disabled
|
} // of catalog is disabled
|
||||||
|
|
||||||
|
// remove from refreshing /after/ checking for enable / disabled, since for
|
||||||
|
// new catalogs, the reference in d->refreshing might be our /only/
|
||||||
|
// reference to the catalog. Once the refresh is done (either failed or
|
||||||
|
// succeeded) the Catalog will be in either d->catalogs or
|
||||||
|
// d->disabledCatalogs
|
||||||
|
if (aReason == Delegate::STATUS_IN_PROGRESS) {
|
||||||
|
d->refreshing.insert(aCat);
|
||||||
|
} else {
|
||||||
|
d->refreshing.erase(aCat);
|
||||||
|
}
|
||||||
|
|
||||||
if (d->refreshing.empty()) {
|
if (d->refreshing.empty()) {
|
||||||
d->fireRefreshStatus(CatalogRef(), Delegate::STATUS_REFRESHED);
|
d->fireRefreshStatus(CatalogRef(), Delegate::STATUS_REFRESHED);
|
||||||
d->firePackagesChanged();
|
d->firePackagesChanged();
|
||||||
|
Loading…
Reference in New Issue
Block a user