From 4d1dd952455e784c17ac0a8096107db208fdca9b Mon Sep 17 00:00:00 2001
From: Markus Blatt <mblatt@dune-project.org>
Date: Wed, 13 Mar 2013 15:38:02 +0000
Subject: [PATCH] [BugFix] Copy rep_ member of SharedCounterImpl during copy
 constructor (otherwise the deleter might work on a unitialized pointer).

[[Imported from SVN: r7420]]
---
 dune/common/shared_ptr.hh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/dune/common/shared_ptr.hh b/dune/common/shared_ptr.hh
index 81da175d2..76273fdfb 100644
--- a/dune/common/shared_ptr.hh
+++ b/dune/common/shared_ptr.hh
@@ -186,12 +186,12 @@ namespace Dune
       /** @brief Constructor from existing Pointer with custom deleter. */
       SharedCountImpl(T* elem,const Deleter& deleter) :
         SharedCount(),
-        rep_(elem),
-        deleter_(deleter)
+        deleter_(deleter),
+        rep_(elem)
       {}
       /** @brief Copy constructor with type conversion. */
       SharedCountImpl(const SharedCountImpl& rep)
-        : SharedCount(rep), deleter_(rep.deleter_) {}
+        : SharedCount(rep), deleter_(rep.deleter_), rep_(rep.rep_) {}
       /** @brief Destructor, deletes element_type* rep_ using deleter. */
       ~SharedCountImpl()
       { deleter_(rep_); }
-- 
GitLab