Skip to content

Commit 932bcfd

Browse files
committed
use unique_ptr and log message when transform fails
1 parent 59202ac commit 932bcfd

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/app/vertextool/qgsvertexeditor.cpp

+5-4
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
#include "qgsvertexeditor.h"
2020
#include "qgsmapcanvas.h"
21+
#include "qgsmessagelog.h"
2122
#include "qgsselectedfeature.h"
2223
#include "qgsvertexentry.h"
2324
#include "qgsvectorlayer.h"
@@ -362,7 +363,7 @@ void QgsVertexEditor::updateVertexSelection( const QItemSelection &selected, con
362363
mSelectedFeature->deselectAllVertices();
363364

364365
QgsCoordinateTransform t( mLayer->crs(), mCanvas->mapSettings().destinationCrs(), QgsProject::instance() );
365-
QgsRectangle *bbox = nullptr;
366+
std::unique_ptr<QgsRectangle> bbox;
366367
QModelIndexList indexList = selected.indexes();
367368
for ( int i = 0; i < indexList.length(); ++i )
368369
{
@@ -372,7 +373,7 @@ void QgsVertexEditor::updateVertexSelection( const QItemSelection &selected, con
372373
// create a bounding box of selected vertices
373374
QgsPointXY point( mSelectedFeature->vertexMap().at( vertexIdx )->point() );
374375
if ( !bbox )
375-
bbox = new QgsRectangle( point, point );
376+
bbox.reset( new QgsRectangle( point, point ) );
376377
else
377378
bbox->combineExtentWith( point );
378379
}
@@ -387,10 +388,10 @@ void QgsVertexEditor::updateVertexSelection( const QItemSelection &selected, con
387388
transformedBbox.combineExtentWith( canvasExtent );
388389
mCanvas->setExtent( transformedBbox );
389390
}
390-
catch ( QgsCsException & )
391+
catch ( QgsCsException &cse )
391392
{
393+
QgsMessageLog::logMessage( QObject::tr( "Simplify transform error caught: %1" ).arg( cse.what() ), QObject::tr( "CRS" ) );
392394
}
393-
delete bbox;
394395
}
395396

396397
mUpdatingVertexSelection = false;

0 commit comments

Comments
 (0)