summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/client/PrivateImplRef.h
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2009-05-04 17:22:33 +0000
committerAlan Conway <aconway@apache.org>2009-05-04 17:22:33 +0000
commitcf3a9eb8cf578be00f0556ff5d93bfdf7c12aec8 (patch)
tree2b67937230ab3aaa1770f85125a77376d616dc05 /cpp/src/qpid/client/PrivateImplRef.h
parent2407f9f523b0eeeb8988e30c797fdb46039fc3d3 (diff)
downloadqpid-python-cf3a9eb8cf578be00f0556ff5d93bfdf7c12aec8.tar.gz
Applied PIMPL pattern to SubscriptionManager.
Cleaned up some sloppy #includes. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@771366 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/client/PrivateImplRef.h')
-rw-r--r--cpp/src/qpid/client/PrivateImplRef.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/cpp/src/qpid/client/PrivateImplRef.h b/cpp/src/qpid/client/PrivateImplRef.h
index ae29318eb9..503a383c31 100644
--- a/cpp/src/qpid/client/PrivateImplRef.h
+++ b/cpp/src/qpid/client/PrivateImplRef.h
@@ -76,14 +76,15 @@ template <class T> class PrivateImplRef {
static intrusive_ptr get(const T& t) { return intrusive_ptr(t.impl); }
static void set(T& t, const intrusive_ptr& p) {
- if(t.impl) boost::intrusive_ptr_release(t.impl);
+ if (t.impl == p) return;
+ if (t.impl) boost::intrusive_ptr_release(t.impl);
t.impl = p.get();
if (t.impl) boost::intrusive_ptr_add_ref(t.impl);
}
// Helper functions to implement the ctor, dtor, copy, assign
static void ctor(T& t, Impl* p) { t.impl = p; if (p) boost::intrusive_ptr_add_ref(p); }
- static void copy(T& t, const T& x) { t.impl = 0; assign(t, x); }
+ static void copy(T& t, const T& x) { if (&t == &x) return; t.impl = 0; assign(t, x); }
static void dtor(T& t) { if(t.impl) boost::intrusive_ptr_release(t.impl); }
static T& assign(T& t, const T& x) { set(t, get(x)); return t;}
};