Skip to content

Commit

Permalink
fix crash on snapping locator removal
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Feb 12, 2015
1 parent 3803979 commit 1b252d4
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/core/qgssnappingutils.cpp
Expand Up @@ -461,21 +461,29 @@ void QgsSnappingUtils::onLayersWillBeRemoved( QStringList layerIds )
// remove locators for layers that are going to be deleted
foreach ( QString layerId, layerIds )
{
for ( LocatorsMap::const_iterator it = mLocators.constBegin(); it != mLocators.constEnd(); ++it )
for ( LocatorsMap::iterator it = mLocators.begin(); it != mLocators.end(); )
{
if ( it.key()->id() == layerId )
{
delete mLocators.take( it.key() );
continue;
delete it.value();
it = mLocators.erase( it );
}
else
{
++it;
}
}

for ( LocatorsMap::const_iterator it = mTemporaryLocators.constBegin(); it != mTemporaryLocators.constEnd(); ++it )
for ( LocatorsMap::iterator it = mTemporaryLocators.begin(); it != mTemporaryLocators.end(); )
{
if ( it.key()->id() == layerId )
{
delete mTemporaryLocators.take( it.key() );
continue;
delete it.value();
it = mTemporaryLocators.erase( it );
}
else
{
++it;
}
}
}
Expand Down

0 comments on commit 1b252d4

Please sign in to comment.