Audit and cleanup uses of AutoGetCollection::getCollection

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Catalog and Routing
    • 2
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      AutoGetCollection now has operators making it behave like a smart pointer.

      With lock free reads it can be dangerous to call AutoGetCollection::getCollection and cache the returned pointer as a subsequent call to AutoGetCollection::getWritableCollection can invalidate the previous pointer.

      We should use operator-> and operator* on the AutoGetCollection when possible to encapsulate the Collection lifetime within the AutoGetCollection.

      While doing this we should also consider changing interfaces that pass along const Collection* to be const Collection&. That would make it clean to get the necessary type by just dereferencing the AutoGetCollection instance.

      Also while we are in here: consider renaming AutoGetCollection::getCollection() to AutoGetCollection::get() to make the interface more consistent with unique and shared pointer. As it is a Collection RAII type, the default return should be a Collection.

            Assignee:
            Unassigned
            Reporter:
            Henrik Edin
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: