Skip to content
Permalink
Browse files

fix crash on snapping locator removal

  • Loading branch information
jef-n committed Feb 12, 2015
1 parent 3803979 commit 1b252d4a939545dc8740653b870a32d4ad8972af
Showing with 14 additions and 6 deletions.
  1. +14 −6 src/core/qgssnappingutils.cpp
@@ -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;
}
}
}

0 comments on commit 1b252d4

Please sign in to comment.
You can’t perform that action at this time.