Fix ref<T>::~ref to not try to RemoveRef if already deleted.
authorRobert Sesek <rsesek@bluestatic.org>
Sat, 8 Oct 2016 21:55:40 +0000 (17:55 -0400)
committerRobert Sesek <rsesek@bluestatic.org>
Sat, 8 Oct 2016 21:56:39 +0000 (17:56 -0400)
Caught by TestReset.

zcpointer.h

index 06ce70c..3155051 100644 (file)
@@ -99,8 +99,10 @@ class ref {
   }
 
   ~ref() {
-    ptr_->get_deleter().RemoveRef(this);
-    MarkDeleted();
+    if (!IsDeleted()) {
+      ptr_->get_deleter().RemoveRef(this);
+      MarkDeleted();
+    }
   }
 
   T* operator->() const {