diff options
Diffstat (limited to 'core/fxcrt/unowned_ptr.h')
-rw-r--r-- | core/fxcrt/unowned_ptr.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/core/fxcrt/unowned_ptr.h b/core/fxcrt/unowned_ptr.h index 0e3bf9e09b..0a44f9db52 100644 --- a/core/fxcrt/unowned_ptr.h +++ b/core/fxcrt/unowned_ptr.h @@ -35,6 +35,13 @@ // other heap object. Use pdfium::span<> for the cases where indexing // into an unowned array is desired, which performs the same checks. +namespace pdfium { + +template <typename T> +class span; + +} // namespace pdfium + namespace fxcrt { template <class T> @@ -95,6 +102,8 @@ class UnownedPtr { T* operator->() const { return m_pObj; } private: + friend class pdfium::span<T>; + inline void ProbeForLowSeverityLifetimeIssue() { #if defined(MEMORY_TOOL_REPLACES_ALLOCATOR) if (m_pObj) @@ -102,6 +111,12 @@ class UnownedPtr { #endif } + inline void ReleaseBadPointer() { +#if defined(MEMORY_TOOL_REPLACES_ALLOCATOR) + m_pObj = nullptr; +#endif + } + T* m_pObj = nullptr; }; |