Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,14 @@ Map::~Map()
// louisdx: This destructor is doing WAY too much. All this should be in a separate function.
// A destructor must never throw, and this destructor does tons of non-exception-safe stuff.

for (ChunkMap::const_iterator it = chunks.begin(); it != chunks.end(); )
{
releaseMap((it++)->first);
// jim: error with the comparison it != chunks.end(), go by mapsize instead
// releaseMap frees the iterator, so use prev
ChunkMap::const_iterator it = chunks.begin();
ChunkMap::const_iterator prev;
while (chunks.size() != 0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider: while (!chunks.empty())
Instead of: while (chunks.size() != 0)

{
prev = it++;
releaseMap(prev->first);
}

// Free item memory
Expand Down
7 changes: 6 additions & 1 deletion src/mineserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,13 @@ Mineserver::Mineserver(int args, char **argarray)
break;
}
}


// VS2012 debug wouldn't be able to find config file without this
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sounds like a problem in the project file for Visual Studio as this will affect non-MSVC.

Do 'Release' builds have the same problem as 'Debug' builds?

#ifdef DEBUG
const std::string path_exe = "../bin/";
#else
const std::string path_exe = "./";
#endif

// If config file is provided as an argument
if (!cfg.empty())
Expand Down