Skip to content

Commit

Permalink
#5623: Fix a resource leak due to the MergeActionNodes not being free…
Browse files Browse the repository at this point in the history
…d until shutdown
  • Loading branch information
codereader committed May 26, 2021
1 parent 8b2605f commit 7820254
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions radiantcore/map/Map.cpp
Expand Up @@ -168,6 +168,11 @@ void Map::loadMapResourceFromLocation(const MapLocation& location)

void Map::abortMergeOperation()
{
for (const auto& mergeAction : _mergeActionNodes)
{
scene::removeNodeFromParent(mergeAction);
}

_mergeActionNodes.clear();
_mergeOperation.reset();
setEditMode(EditMode::Normal);
Expand Down Expand Up @@ -982,6 +987,8 @@ void Map::mergeMap(const cmd::ArgumentList& args)
throw cmd::ExecutionFailure(fmt::format(_("File doesn't exist: {0}"), candidate));
}

abortMergeOperation();

auto resource = GlobalMapResourceManager().createFromPath(candidate);

try
Expand Down Expand Up @@ -1086,6 +1093,8 @@ void Map::initialiseModule(const IApplicationContext& ctx)

void Map::shutdownModule()
{
abortMergeOperation();

GlobalRadiantCore().getMessageBus().removeListener(_shutdownListener);

_scaledModelExporter.shutdown();
Expand Down

0 comments on commit 7820254

Please sign in to comment.