-
-
Save Zeno-/e9a95468ef61159660fb to your computer and use it in GitHub Desktop.
fix mem leak
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -2272,21 +2272,33 @@ void ServerMap::finishBlockMake(BlockMakeData *data, | |
bool enable_mapgen_debug_info = m_emerge->mapgen_debug_info; | |
/*infostream<<"Resulting vmanip:"<<std::endl; | |
data->vmanip.print(infostream);*/ | |
+ MapBlock *prev_block = NULL; | |
// Make sure affected blocks are loaded | |
for(s16 x=blockpos_min.X-extra_borders.X; | |
x<=blockpos_max.X+extra_borders.X; x++) | |
for(s16 z=blockpos_min.Z-extra_borders.Z; | |
z<=blockpos_max.Z+extra_borders.Z; z++) | |
for(s16 y=blockpos_min.Y-extra_borders.Y; | |
y<=blockpos_max.Y+extra_borders.Y; y++) | |
{ | |
v3s16 p(x, y, z); | |
// Load from disk if not already in memory | |
- emergeBlock(p, false); | |
+ MapBlock *block = emergeBlock(p, false); | |
+ if (prev_block != block && data->transforming_liquid.size() > 0) { | |
+ /* Copy transforming liquid information | |
+ */ | |
+ while(data->transforming_liquid.size() > 0) | |
+ { | |
+ v3s16 p = data->transforming_liquid.pop_front(); | |
+ m_transforming_liquid.push_back(p); | |
+ } | |
+ block->raiseModified(MOD_STATE_WRITE_NEEDED, "transforming liquids"); | |
+ prev_block = block; | |
+ } | |
} | |
/* | |
Blit generated stuff to map | |
NOTE: blitBackAll adds nearly everything to changed_blocks | |
@@ -2298,19 +2310,10 @@ void ServerMap::finishBlockMake(BlockMakeData *data, | |
} | |
EMERGE_DBG_OUT("finishBlockMake: changed_blocks.size()=" << changed_blocks.size()); | |
/* | |
- Copy transforming liquid information | |
- */ | |
- while(data->transforming_liquid.size() > 0) | |
- { | |
- v3s16 p = data->transforming_liquid.pop_front(); | |
- m_transforming_liquid.push_back(p); | |
- } | |
- | |
- /* | |
Do stuff in central blocks | |
*/ | |
/* | |
Update lighting |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment