mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Fix some reference counters (memleak) (#8981)
Fix some reference counters (memleak) Map::dispatchEvent: Allocation safety using references
This commit is contained in:
parent
d77ea76476
commit
26b39f1eae
12 changed files with 30 additions and 37 deletions
|
@ -1035,7 +1035,7 @@ int ModApiEnvMod::l_fix_light(lua_State *L)
|
|||
for (auto &modified_block : modified_blocks)
|
||||
event.modified_blocks.insert(modified_block.first);
|
||||
|
||||
map.dispatchEvent(&event);
|
||||
map.dispatchEvent(event);
|
||||
}
|
||||
lua_pushboolean(L, success);
|
||||
|
||||
|
@ -1144,7 +1144,7 @@ int ModApiEnvMod::l_delete_area(lua_State *L)
|
|||
}
|
||||
}
|
||||
|
||||
map.dispatchEvent(&event);
|
||||
map.dispatchEvent(event);
|
||||
lua_pushboolean(L, success);
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ void NodeMetaRef::reportMetadataChange(const std::string *name)
|
|||
event.type = MEET_BLOCK_NODE_METADATA_CHANGED;
|
||||
event.p = m_p;
|
||||
event.is_private_change = name && meta && meta->isPrivate(*name);
|
||||
m_env->getMap().dispatchEvent(&event);
|
||||
m_env->getMap().dispatchEvent(event);
|
||||
}
|
||||
|
||||
// Exported functions
|
||||
|
|
|
@ -126,7 +126,7 @@ int LuaVoxelManip::l_write_to_map(lua_State *L)
|
|||
for (const auto &modified_block : o->modified_blocks)
|
||||
event.modified_blocks.insert(modified_block.first);
|
||||
|
||||
map->dispatchEvent(&event);
|
||||
map->dispatchEvent(event);
|
||||
|
||||
o->modified_blocks.clear();
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue