Index: core/fpdfapi/fpdf_page/cpdf_countedobject.h |
diff --git a/core/fpdfapi/fpdf_page/cpdf_countedobject.h b/core/fpdfapi/fpdf_page/cpdf_countedobject.h |
index e7f4ab6af0efe8375919264580d429a7a6185ae8..c61e02458917c6b7f54004530d71154685389b91 100644 |
--- a/core/fpdfapi/fpdf_page/cpdf_countedobject.h |
+++ b/core/fpdfapi/fpdf_page/cpdf_countedobject.h |
@@ -20,8 +20,10 @@ class CPDF_CountedObject { |
m_pObj = ptr; |
} |
void clear() { // Now you're all weak ptrs ... |
- delete m_pObj; |
+ // Guard against accidental re-entry. |
+ T* pObj = m_pObj; |
m_pObj = nullptr; |
+ delete pObj; |
} |
T* get() const { return m_pObj; } |
T* AddRef() { |