From 26b39f1eae1f576669cbf49c6db94ef4ed8624df Mon Sep 17 00:00:00 2001 From: SmallJoker Date: Tue, 24 Sep 2019 19:05:28 +0200 Subject: Fix some reference counters (memleak) (#8981) Fix some reference counters (memleak) Map::dispatchEvent: Allocation safety using references --- src/map.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/map.cpp') diff --git a/src/map.cpp b/src/map.cpp index 022eb9f19..0a7099a06 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -89,7 +89,7 @@ void Map::removeEventReceiver(MapEventReceiver *event_receiver) m_event_receivers.erase(event_receiver); } -void Map::dispatchEvent(MapEditEvent *event) +void Map::dispatchEvent(const MapEditEvent &event) { for (MapEventReceiver *event_receiver : m_event_receivers) { event_receiver->onMapEditEvent(event); @@ -274,7 +274,7 @@ bool Map::addNodeWithEvent(v3s16 p, MapNode n, bool remove_metadata) succeeded = false; } - dispatchEvent(&event); + dispatchEvent(event); return succeeded; } @@ -299,7 +299,7 @@ bool Map::removeNodeWithEvent(v3s16 p) succeeded = false; } - dispatchEvent(&event); + dispatchEvent(event); return succeeded; } @@ -2220,7 +2220,7 @@ MapBlock* ServerMap::loadBlock(v3s16 blockpos) for (it = modified_blocks.begin(); it != modified_blocks.end(); ++it) event.modified_blocks.insert(it->first); - dispatchEvent(&event); + dispatchEvent(event); } } return block; -- cgit v1.2.3