Commit e63d3239 authored by Carlo Vanini's avatar Carlo Vanini
Browse files

Emit signals when the cache is reloaded.

Reloading the cache deletes the current list of packages and creates a new one,
creating new Package objects. Any reference (pointer) and iterator must be
invalidated. The new signals allow to be notified when this happens.

This is needed by Muon to solve bug 332530.

REVIEW: 127080
parent 726defa3
......@@ -174,6 +174,8 @@ bool Backend::reloadCache()
{
Q_D(Backend);
emit cacheReloadStarted();
if (!d->cache->open()) {
setInitError();
return false;
......@@ -243,6 +245,8 @@ bool Backend::reloadCache()
// Determine which packages are pinned for display purposes
loadPackagePins();
emit cacheReloadFinished();
return true;
}
......
......@@ -460,6 +460,29 @@ Q_SIGNALS:
*/
void packageChanged();
/**
* Emitted when the apt cache reload is started.
*
* After this signal is emitted all @c Package in the backend will be
* deleted. Therefore, all pointers obtained in precedence from the backend
* shall not be used anymore. This includes any @c PackageList returned by
* availablePackages(), upgradeablePackages(), markedPackages() and search().
*
* Also @c pkgCache::PkgIterator are invalidated.
*
* Wait for signal cacheReloadFinished() before requesting a new list of packages.
*
* @see reloadCache()
*/
void cacheReloadStarted();
/**
* Emitted after the apt cache has been reloaded.
*
* @see cacheReloadStarted();
*/
void cacheReloadFinished();
/**
* This signal is emitted when a Xapian search cache update is started.
*
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment