From 0e4636284b057fd9096b607497e1c4cafca07883 Mon Sep 17 00:00:00 2001 From: hjfod Date: Fri, 31 Mar 2023 11:36:54 +0300 Subject: [PATCH] fix multiple weak refs causing a memory leak --- loader/src/utils/cocos.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loader/src/utils/cocos.cpp b/loader/src/utils/cocos.cpp index 2ead3eef..cc43087a 100644 --- a/loader/src/utils/cocos.cpp +++ b/loader/src/utils/cocos.cpp @@ -253,7 +253,7 @@ bool WeakRefPool::isManaged(CCObject* obj) { } void WeakRefPool::manage(CCObject* obj) { - if (obj) { + if (obj && !m_pool.contains(obj)) { obj->retain(); m_pool.insert(obj); }