Skip to content
  • Daniel Vrátil's avatar
    ETM: fix race condition during Collection population · 679616d2
    Daniel Vrátil authored
    When populating Collections in ETM we may receive a "Collection added"
    notification. If the Collection doesn't belong to an already-populated
    subtree the code in ETMPrivate::retrieveAncestors() will try to iterate
    through the chain of parent Collections to figure out which Collections
    are missing and must be retrieved. However, Collections from the Monitor
    notifications have only one parent set (the ancestor chain is not complete)
    and so the code would get stuck.
    
    This change makes retrieveAncestors() to handle the situation gracefuly
    by fetching the entire ancestor chain from Akonadi recursively.
    
    This got discovered by etmpopulationtest where the monitor likely
    received a delayed notification that we sent during the initial
    population of Akonadi by Knut resources.
    679616d2