Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(181)

Unified Diff: core/fpdfapi/fpdf_page/cpdf_countedobject.h

Issue 2364673002: Null CPDF_CountedObj::m_pObj prior to deletion (Closed)
Patch Set: Copy comment from strings header, fix old comment Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | core/fxcrt/cfx_string_data_template.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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() {
« no previous file with comments | « no previous file | core/fxcrt/cfx_string_data_template.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698