diff options
| author | Carlo Vanini <silhusk@gmail.com> | 2015-09-21 07:15:26 (GMT) |
|---|---|---|
| committer | Carlo Vanini <silhusk@gmail.com> | 2016-03-03 08:45:11 (GMT) |
| commit | e63d3239a7846eb968151ebdd4f12e0921e0f13a (patch) | |
| tree | 6c1896c7335298a8de62a6d3b5d9ef82c8843da0 | |
| parent | 726defa3188a1449312e212085f914e97e29f76f (diff) | |
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
| -rw-r--r-- | src/backend.cpp | 4 | ||||
| -rw-r--r-- | src/backend.h | 23 |
2 files changed, 27 insertions, 0 deletions
diff --git a/src/backend.cpp b/src/backend.cpp index d2be051..4fbd382 100644 --- a/src/backend.cpp +++ b/src/backend.cpp @@ -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; } diff --git a/src/backend.h b/src/backend.h index f09602b..f7cb809 100644 --- a/src/backend.h +++ b/src/backend.h @@ -461,6 +461,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. * * Slots connected to this signal can then listen to the xapianUpdateProgress |
