fix: clean up base::LinkedList in context_bridge::ObjectCache (#27630)
base::LinkedList does not delete its members on destruction. We need to manually ensure the linkedlist is empty when the ObjectCache is destroyed. Fixes #27039 Notes: Fixed memory leak when sending non-primitives over the context bridge
This commit is contained in:
parent
d06bb7c97b
commit
b6a91ef5df
1 changed files with 9 additions and 1 deletions
|
@ -21,7 +21,15 @@ ObjectCachePairNode::ObjectCachePairNode(ObjectCachePair&& pair) {
|
|||
ObjectCachePairNode::~ObjectCachePairNode() = default;
|
||||
|
||||
ObjectCache::ObjectCache() {}
|
||||
ObjectCache::~ObjectCache() = default;
|
||||
ObjectCache::~ObjectCache() {
|
||||
for (const auto& pair : proxy_map_) {
|
||||
while (!pair.second.empty()) {
|
||||
ObjectCachePairNode* node = pair.second.head()->value();
|
||||
node->RemoveFromList();
|
||||
delete node;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ObjectCache::CacheProxiedObject(v8::Local<v8::Value> from,
|
||||
v8::Local<v8::Value> proxy_value) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue