Skip to content

Commit

Permalink
common/RefCountedObject: assert nref == 0 in dtor
Browse files Browse the repository at this point in the history
Signed-off-by: Sage Weil <[email protected]>
  • Loading branch information
Sage Weil committed Jul 3, 2014
1 parent ff1521f commit 45991c0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/common/RefCountedObj.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ struct RefCountedObject {
atomic_t nref;
CephContext *cct;
RefCountedObject(CephContext *c = NULL, int n=1) : nref(n), cct(c) {}
virtual ~RefCountedObject() {}
virtual ~RefCountedObject() {
assert(nref.read() == 0);
}

RefCountedObject *get() {
int v = nref.inc();
Expand Down

0 comments on commit 45991c0

Please sign in to comment.