diff options
author | SmallJoker <SmallJoker@users.noreply.github.com> | 2019-09-24 19:05:28 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-24 19:05:28 +0200 |
commit | 26b39f1eae1f576669cbf49c6db94ef4ed8624df (patch) | |
tree | dd0a508d4d6987f2c667cbf342955f64ebbd02af /src/script | |
parent | d77ea764768f5cde9e8f0781356a67d723aa7609 (diff) | |
download | minetest-26b39f1eae1f576669cbf49c6db94ef4ed8624df.tar.gz minetest-26b39f1eae1f576669cbf49c6db94ef4ed8624df.tar.bz2 minetest-26b39f1eae1f576669cbf49c6db94ef4ed8624df.zip |
Fix some reference counters (memleak) (#8981)
Fix some reference counters (memleak)
Map::dispatchEvent: Allocation safety using references
Diffstat (limited to 'src/script')
-rw-r--r-- | src/script/lua_api/l_env.cpp | 4 | ||||
-rw-r--r-- | src/script/lua_api/l_nodemeta.cpp | 2 | ||||
-rw-r--r-- | src/script/lua_api/l_vmanip.cpp | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/src/script/lua_api/l_env.cpp b/src/script/lua_api/l_env.cpp index 34e079af7..a56b1cb0b 100644 --- a/src/script/lua_api/l_env.cpp +++ b/src/script/lua_api/l_env.cpp @@ -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; } diff --git a/src/script/lua_api/l_nodemeta.cpp b/src/script/lua_api/l_nodemeta.cpp index 22fc61782..229ce73db 100644 --- a/src/script/lua_api/l_nodemeta.cpp +++ b/src/script/lua_api/l_nodemeta.cpp @@ -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 diff --git a/src/script/lua_api/l_vmanip.cpp b/src/script/lua_api/l_vmanip.cpp index c92983bd3..fd73d21d1 100644 --- a/src/script/lua_api/l_vmanip.cpp +++ b/src/script/lua_api/l_vmanip.cpp @@ -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; |