summaryrefslogtreecommitdiff
path: root/core/fpdfapi
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfapi')
-rw-r--r--core/fpdfapi/fpdf_page/cpdf_countedobject.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/core/fpdfapi/fpdf_page/cpdf_countedobject.h b/core/fpdfapi/fpdf_page/cpdf_countedobject.h
index e7f4ab6af0..c61e024589 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() {