diff options
| author | Maxime Coste <mawww@kakoune.org> | 2017-08-04 11:38:04 +0700 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2017-08-04 11:38:04 +0700 |
| commit | 45a7496f545bf7b10940bc55c27ddf018a1ffd17 (patch) | |
| tree | 4f4ba6434083d518f5217f27006d15adeb4fa739 /src/safe_ptr.hh | |
| parent | 420c6aca233e79249ffc8513347f73978eb0ecdc (diff) | |
Fix SafeCountable and RefCountable copy/move logic
The safe and ref counts should not get copied around.
Diffstat (limited to 'src/safe_ptr.hh')
| -rw-r--r-- | src/safe_ptr.hh | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/safe_ptr.hh b/src/safe_ptr.hh index 4d83a46d..38d58046 100644 --- a/src/safe_ptr.hh +++ b/src/safe_ptr.hh @@ -24,7 +24,7 @@ class SafeCountable { public: #ifdef KAK_DEBUG - SafeCountable() : m_count(0) {} + SafeCountable() {} ~SafeCountable() { kak_assert(m_count == 0); @@ -33,6 +33,12 @@ public: #endif } + SafeCountable(const SafeCountable&) {} + SafeCountable(SafeCountable&&) {} + + SafeCountable& operator=(const SafeCountable& other) { return *this; } + SafeCountable& operator=(SafeCountable&& other) { return *this; } + private: friend struct SafeCountablePolicy; #ifdef SAFE_PTR_TRACK_CALLSTACKS @@ -45,7 +51,7 @@ private: mutable Vector<Callstack> m_callstacks; #endif - mutable int m_count; + mutable int m_count = 0; #endif }; |
