Skip to content
  • Milian Wolff's avatar
    Add missing mutex locking for some ItemRepository functions · 2032a721
    Milian Wolff authored
    These are all not thread safe and thus must lock the mutex or
    risk undefined behavior.
    
    Igor Kushnir writes:
    > ItemRepository::close() was called from:
    >
    > 1. ~ItemRepository() and ItemRepository::open() - no need for a lock;
    > 2. ItemRepositoryRegistry::unRegisterRepository() - no need for a lock because unRegisterRepository() is called only from within ~ItemRepository(). But there seems to be an inefficiency here: close() is called from unRegisterRepository() and then immediately from ~ItemRepository() again. Should perhaps this call be removed from unRegisterRepository()?
    > 3. from ItemRepositoryRegistryPrivate::close(), which in turn is called from ~ItemRepositoryRegistry(). Here the missing mutex lock might have been a bug.
    
    Then there was `ItemRepositoryRegistry::printAllStatistics` which
    didn't lock the repository mutex when printing statistics.
    2032a721