Skip to content
Snippets Groups Projects
Commit b443fb28 authored by Pierre Lamot's avatar Pierre Lamot Committed by Steve Lhomme
Browse files

qt: fix assertion in asyncFetchMore when cache tries to recursively refer items

The failling scenario is
* Count&Load task issued (task n°1)
* model need reset (thumbnail is updated for instance) => `needReload = true`
* Count&Load task (n°1) is resolved
  * diff util insert/remove rows
  * Callback from model change ask to refer an item beyond the cache
    * refer issue a new 'fetch more' request (n°2) as m_countTask is 0
  * as `needReload == true`, cache is moved to oldCache, new count&load request
    is issued (n° 3)
* task n°2 resolve, cache is null, assertion fails

by moving the `m_countTask` reset after the model update, we ensure that `refer`
won't start a new request while the model is still propagating the update.
parent 04f140a9
No related branches found
No related tags found
1 merge request!6504qt: fix assertion in asyncFetchMore when cache tries to recursively refer items
Pipeline #544578 passed with stage
in 17 minutes and 36 seconds
......@@ -521,8 +521,6 @@ void ListCache<T>::asyncCountAndLoad()
if (m_countTask != taskId)
return;
m_countTask = 0;
//quite unlikley but model may change between count and load
if (unlikely(list.size() > maximumCount))
{
......@@ -556,6 +554,8 @@ void ListCache<T>::asyncCountAndLoad()
emit localSizeChanged(0, m_cachedData->maximumCount);
}
m_countTask = 0;
if (m_needReload)
{
m_needReload = false;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment