Further changes required to make the QWidget-based MSC work with the new Application
author Jonathan Thomas
committer Jonathan Thomas
commit 557a043c3ff3ced94cbff43aa9a1efffe36b1327
tree 666dfe396c9ac19e321b8932e38e59d06f5a1412
parent 904e4e4f19b2a2364450c548164ef59f6eb0aab7
Further changes required to make the QWidget-based MSC work with the new Application
object package invalidation scheme. Application objects inside the ApplicationModel's
internal list weren't being cleared before reload, so MSC was crashing trying to get
data from stale pointers. Additionally, since the QApt Backend's refreshCache()
function used QCoreApplication::processEvents to make it sort of asynchronous, the
ApplicationModel needs to be temporarily cleared so that it doesn't try access package
data in the middle of the APT cache reload. (Which didn't matter before since we were
reloading the entire MSC view)

What happens now during a cache refresh upon the completion of an installation/removal
is that the view momentarily clears itself. Once the refresh is complete all the data
is then re-displayed, without warping the user back to the main window. I think that's
probably the best we'll be able to do, since we can't paint anything requiring
package data during the backend's reload.

I also changed it so that reviews/ratings stuff gets cleared on every cache refresh, as
their package pointers will all be stale and really do have to be reloaded. This new
refresh scheme is really an improvement on the experience since we don't have to refresh
the whole UI, thanks Aleix. :)