[QGIS Commit] r12207 - trunk/qgis/src/plugins/labeling
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Fri Nov 20 08:39:12 EST 2009
Author: wonder
Date: 2009-11-20 08:39:09 -0500 (Fri, 20 Nov 2009)
New Revision: 12207
Modified:
trunk/qgis/src/plugins/labeling/pallabeling.cpp
Log:
catch "feature exists" exception (to avoid crash) in case the provider goes crazy and returns duplicate feature IDs.
Modified: trunk/qgis/src/plugins/labeling/pallabeling.cpp
===================================================================
--- trunk/qgis/src/plugins/labeling/pallabeling.cpp 2009-11-20 12:39:51 UTC (rev 12206)
+++ trunk/qgis/src/plugins/labeling/pallabeling.cpp 2009-11-20 13:39:09 UTC (rev 12207)
@@ -216,6 +216,7 @@
labelY = fabs( ptSize.y() - ptZero.y() );
}
+
void LayerSettings::registerFeature( QgsFeature& f )
{
QString labelText = f.attributeMap()[fieldIndex].toString();
@@ -232,8 +233,16 @@
geometries.append( lbl );
// register feature to the layer
- if ( !palLayer->registerFeature( lbl->strId(), lbl, labelX, labelY, labelText.toUtf8().constData() ) )
+ try
+ {
+ if ( !palLayer->registerFeature( lbl->strId(), lbl, labelX, labelY, labelText.toUtf8().constData() ) )
+ return;
+ }
+ catch ( std::exception* e )
+ {
+ std::cerr << "Ignoring feature " << f.id() << " due PAL exception: " << e->what() << std::endl;
return;
+ }
// TODO: only for placement which needs character info
pal::Feature* feat = palLayer->getFeature( lbl->strId() );
More information about the QGIS-commit
mailing list