diff options
| author | kat <kat@vector35.com> | 2024-10-28 11:58:15 -0400 |
|---|---|---|
| committer | kat <kat@vector35.com> | 2024-10-28 12:58:51 -0400 |
| commit | 07bce5f257d30061475452ec9c2e06a132747b54 (patch) | |
| tree | 434dbd4660b981edd81c3f1651e868aacb240b26 /view/sharedcache/api/sharedcacheapi.h | |
| parent | 891b8c0d4366266c0b9af08037dbd71c54cf86b3 (diff) | |
[SharedCache] Fix UI causing BV leaks
Diffstat (limited to 'view/sharedcache/api/sharedcacheapi.h')
| -rw-r--r-- | view/sharedcache/api/sharedcacheapi.h | 137 |
1 files changed, 0 insertions, 137 deletions
diff --git a/view/sharedcache/api/sharedcacheapi.h b/view/sharedcache/api/sharedcacheapi.h index efd38532..19f021e7 100644 --- a/view/sharedcache/api/sharedcacheapi.h +++ b/view/sharedcache/api/sharedcacheapi.h @@ -91,143 +91,6 @@ namespace SharedCacheAPI { } }; - - template<class T> - class SCRef { - T *m_obj; -#ifdef BN_REF_COUNT_DEBUG - void* m_assignmentTrace = nullptr; -#endif - - public: - SCRef<T>() : m_obj(NULL) {} - - SCRef<T>(T *obj) : m_obj(obj) { - if (m_obj) { - m_obj->AddRef(); -#ifdef BN_REF_COUNT_DEBUG - m_assignmentTrace = BNRegisterObjectRefDebugTrace(typeid(T).name()); -#endif - } - } - - SCRef<T>(const SCRef<T> &obj) : m_obj(obj.m_obj) { - if (m_obj) { - m_obj->AddRef(); -#ifdef BN_REF_COUNT_DEBUG - m_assignmentTrace = BNRegisterObjectRefDebugTrace(typeid(T).name()); -#endif - } - } - - SCRef<T>(SCRef<T> &&other) : m_obj(other.m_obj) { - other.m_obj = 0; -#ifdef BN_REF_COUNT_DEBUG - m_assignmentTrace = other.m_assignmentTrace; -#endif - } - - ~SCRef<T>() { - if (m_obj) { - m_obj->Release(); -#ifdef BN_REF_COUNT_DEBUG - BNUnregisterObjectRefDebugTrace(typeid(T).name(), m_assignmentTrace); -#endif - } - } - - SCRef<T> &operator=(const Ref<T> &obj) { -#ifdef BN_REF_COUNT_DEBUG - if (m_obj) - BNUnregisterObjectRefDebugTrace(typeid(T).name(), m_assignmentTrace); - if (obj.m_obj) - m_assignmentTrace = BNRegisterObjectRefDebugTrace(typeid(T).name()); -#endif - T *oldObj = m_obj; - m_obj = obj.m_obj; - if (m_obj) - m_obj->AddRef(); - if (oldObj) - oldObj->Release(); - return *this; - } - - SCRef<T> &operator=(SCRef<T> &&other) { - if (m_obj) { -#ifdef BN_REF_COUNT_DEBUG - BNUnregisterObjectRefDebugTrace(typeid(T).name(), m_assignmentTrace); -#endif - m_obj->Release(); - } - m_obj = other.m_obj; - other.m_obj = 0; -#ifdef BN_REF_COUNT_DEBUG - m_assignmentTrace = other.m_assignmentTrace; -#endif - return *this; - } - - SCRef<T> &operator=(T *obj) { -#ifdef BN_REF_COUNT_DEBUG - if (m_obj) - BNUnregisterObjectRefDebugTrace(typeid(T).name(), m_assignmentTrace); - if (obj) - m_assignmentTrace = BNRegisterObjectRefDebugTrace(typeid(T).name()); -#endif - T *oldObj = m_obj; - m_obj = obj; - if (m_obj) - m_obj->AddRef(); - if (oldObj) - oldObj->Release(); - return *this; - } - - operator T *() const { - return m_obj; - } - - T *operator->() const { - return m_obj; - } - - T &operator*() const { - return *m_obj; - } - - bool operator!() const { - return m_obj == NULL; - } - - bool operator==(const T *obj) const { - return T::GetObject(m_obj) == T::GetObject(obj); - } - - bool operator==(const SCRef<T> &obj) const { - return T::GetObject(m_obj) == T::GetObject(obj.m_obj); - } - - bool operator!=(const T *obj) const { - return T::GetObject(m_obj) != T::GetObject(obj); - } - - bool operator!=(const SCRef<T> &obj) const { - return T::GetObject(m_obj) != T::GetObject(obj.m_obj); - } - - bool operator<(const T *obj) const { - return T::GetObject(m_obj) < T::GetObject(obj); - } - - bool operator<(const SCRef<T> &obj) const { - return T::GetObject(m_obj) < T::GetObject(obj.m_obj); - } - - T *GetPtr() const { - return m_obj; - } - }; - struct DSCMemoryRegion { uint64_t vmAddress; uint64_t size; |
