]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
shared_cache: clear lru in destructor
authorSamuel Just <sam.just@inktank.com>
Tue, 19 Mar 2013 21:46:20 +0000 (14:46 -0700)
committerSamuel Just <sam.just@inktank.com>
Fri, 22 Mar 2013 01:37:35 +0000 (18:37 -0700)
Otherwise, the live references will attempt to extricate
themselves from a disolving SharedLRU instance as the
member destructors run.

Signed-off-by: Samuel Just <sam.just@inktank.com>
src/common/shared_cache.hpp

index 1bbfa0e354f2db9ea6b6a40be3f2ee1263c214f0..69a4c06dfbf5f4b79ea27cd599136440da463eb4 100644 (file)
@@ -78,6 +78,12 @@ class SharedLRU {
 
 public:
   SharedLRU(size_t max_size = 20) : lock("SharedLRU::lock"), max_size(max_size) {}
+  
+  ~SharedLRU() {
+    contents.clear();
+    lru.clear();
+    assert(weak_refs.empty());
+  }
 
   void set_size(size_t new_size) {
     list<VPtr> to_release;