From 658d2f98437815782691571f373b42321ffc9226 Mon Sep 17 00:00:00 2001 From: sbrandt Date: Wed, 12 Feb 2014 18:41:29 +0000 Subject: Fix for #1521 git-svn-id: http://svn.cactuscode.org/flesh/trunk@5082 17b73243-c579-4c4c-a9d2-2d5706c11dac --- src/piraha/smart_ptr.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/piraha/smart_ptr.hpp b/src/piraha/smart_ptr.hpp index 1d9dcf6f..71e3b4d6 100644 --- a/src/piraha/smart_ptr.hpp +++ b/src/piraha/smart_ptr.hpp @@ -135,6 +135,8 @@ class smart_ptr { } void operator=(const smart_ptr& s) { assert(this != NULL); + if(guts == s.guts) + return; clean(); guts = s.guts; if(guts != NULL) @@ -162,7 +164,7 @@ class smart_ptr { bool valid() const { return guts != NULL && guts->ptr != NULL; } - int ref_count() { + int ref_count() const { assert(guts != NULL); return guts->ref_count_(); } -- cgit v1.2.3