Skip to content

Commit

Permalink
Fix AlgorithmFactory::unsubscribe method to updates version map.
Browse files Browse the repository at this point in the history
It was previously not updating the version map when the algorithm was
removed and then subscribing the same thing again would throw an error.
Refs #7263
  • Loading branch information
martyngigg committed Jun 29, 2013
1 parent 12dfaa0 commit f6992fc
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Code/Mantid/Framework/API/src/AlgorithmFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,17 @@ namespace Mantid
try
{
Kernel::DynamicFactory<Algorithm>::unsubscribe(key);
// Update version map accordingly
VersionMap::iterator it = m_vmap.find(algorithmName);
if(it != m_vmap.end())
{
int highest_version = it->second;
if(highest_version > 1 && version == highest_version) // Decrement the highest version
{
it->second -= 1;
}
else m_vmap.erase(algorithmName);
}
}
catch(Kernel::Exception::NotFoundError&)
{
Expand Down

0 comments on commit f6992fc

Please sign in to comment.