Browse Source

qt: fix cleanup of cache

reverts 018f4890c1
it was not that m_cachedData was deleted (see commit above) but the parent cache
itself was deleted after emitting a signal in its member function

fix: don't instantly clean up the cache in the source when requested
since the requester can be the cache itself.

fixes empty label is not visible in any view
fixes model is always in a loading state
pull/162/head
Prince Gupta 2 years ago
committed by Steve Lhomme
parent
commit
b4b28fcd44
  1. 5
      modules/gui/qt/util/base_model_p.hpp
  2. 2
      modules/gui/qt/util/listcache.hxx

5
modules/gui/qt/util/base_model_p.hpp

@ -83,7 +83,10 @@ protected:
{
Q_Q(BaseModel);
emit q->beginResetModel();
cache.reset();
// 'abandon' existing cache and queue it for deletion
cache->disconnect(q);
cache->deleteLater();
cache.release();
emit q->endResetModel();
validateCache();
}

2
modules/gui/qt/util/listcache.hxx

@ -482,8 +482,6 @@ void ListCache<T>::asyncCountAndLoad()
? std::min(m_limit, maximumCount)
: maximumCount;
if (queryCount == 0)
return;
//note: should we drop items past queryCount?
m_cachedData = std::make_unique<CacheData>(std::move(list),
queryCount,

Loading…
Cancel
Save