aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/RefCount.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbTk/RefCount.hh')
-rw-r--r--src/FbTk/RefCount.hh6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/FbTk/RefCount.hh b/src/FbTk/RefCount.hh
index 2595864..cc8c917 100644
--- a/src/FbTk/RefCount.hh
+++ b/src/FbTk/RefCount.hh
@@ -37,11 +37,10 @@ public:
37 RefCount(const RefCount<Pointer2> &copy); 37 RefCount(const RefCount<Pointer2> &copy);
38 ~RefCount(); 38 ~RefCount();
39 RefCount<Pointer> &operator = (const RefCount<Pointer> &copy); 39 RefCount<Pointer> &operator = (const RefCount<Pointer> &copy);
40 RefCount<Pointer> &operator = (Pointer *p);
41 Pointer &operator * () const { return *get(); } 40 Pointer &operator * () const { return *get(); }
42 Pointer *operator -> () const { return get(); } 41 Pointer *operator -> () const { return get(); }
43 Pointer *get() const { return m_data; } 42 Pointer *get() const { return m_data; }
44 void reset(Pointer *p) { *this = p; } 43 void reset(Pointer *p = 0);
45 /// conversion to "bool" 44 /// conversion to "bool"
46 operator bool_type() const { return m_data ? &RefCount::m_data : 0; } 45 operator bool_type() const { return m_data ? &RefCount::m_data : 0; }
47 46
@@ -100,12 +99,11 @@ RefCount<Pointer> &RefCount<Pointer>::operator = (const RefCount<Pointer> &copy)
100} 99}
101 100
102template <typename Pointer> 101template <typename Pointer>
103RefCount<Pointer> &RefCount<Pointer>::operator = (Pointer *p) { 102void RefCount<Pointer>::reset(Pointer *p) {
104 decRefCount(); 103 decRefCount();
105 m_data = p; // set data pointer 104 m_data = p; // set data pointer
106 m_refcount = new unsigned int(0); // create new counter 105 m_refcount = new unsigned int(0); // create new counter
107 incRefCount(); 106 incRefCount();
108 return *this;
109} 107}
110 108
111template <typename Pointer> 109template <typename Pointer>