Navigation Menu

Skip to content

Commit

Permalink
Avoid detach of temporary
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Aug 29, 2017
1 parent 5247478 commit 2b14c46
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/analysis/interpolation/qgsgridfilewriter.cpp
Expand Up @@ -98,7 +98,7 @@ int QgsGridFileWriter::writeFile( QgsFeedback *feedback )

// create prj file
QgsInterpolator::LayerData ld;
ld = mInterpolator->layerData().first();
ld = mInterpolator->layerData().at( 0 );
QgsVectorLayer *vl = ld.vectorLayer;
QString crs = vl->crs().toWkt();
QFileInfo fi( mOutputFilePath );
Expand Down
3 changes: 2 additions & 1 deletion src/app/qgsmaptooladdpart.cpp
Expand Up @@ -68,7 +68,8 @@ void QgsMapToolAddPart::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
}

bool isGeometryEmpty = false;
if ( vlayer->selectedFeatures()[0].geometry().isNull() )
QgsFeatureList selectedFeatures = vlayer->selectedFeatures();
if ( !selectedFeatures.isEmpty() && selectedFeatures.at( 0 ).geometry().isNull() )
isGeometryEmpty = true;

if ( !checkSelection() )
Expand Down
9 changes: 6 additions & 3 deletions src/app/qgsmeasuredialog.cpp
Expand Up @@ -156,7 +156,8 @@ void QgsMeasureDialog::mouseMove( const QgsPointXY &point )
}
else if ( !mMeasureArea && mTool->points().size() >= 1 )
{
QgsPointXY p1( mTool->points().last() ), p2( point );
QList< QgsPointXY > tmpPoints = mTool->points();
QgsPointXY p1( tmpPoints.at( tmpPoints.size() - 1 ) ), p2( point );
double d = mDa.measureLine( p1, p2 );

editTotal->setText( formatDistance( mTotal + d ) );
Expand Down Expand Up @@ -224,7 +225,8 @@ void QgsMeasureDialog::removeLastPoint()
if ( !mTool->done() )
{
// need to add the distance for the temporary mouse cursor point
QgsPointXY p1( mTool->points().last() );
QList< QgsPointXY > tmpPoints = mTool->points();
QgsPointXY p1( tmpPoints.at( tmpPoints.size() - 1 ) );
double d = mDa.measureLine( p1, mLastMousePoint );

d = convertLength( d, mDistanceUnits );
Expand Down Expand Up @@ -481,7 +483,8 @@ void QgsMeasureDialog::updateUi()

QgsPointXY p1, p2;
mTotal = 0;
for ( it = mTool->points().constBegin(); it != mTool->points().constEnd(); ++it )
QList< QgsPointXY > tmpPoints = mTool->points();
for ( it = tmpPoints.constBegin(); it != tmpPoints.constEnd(); ++it )
{
p2 = *it;
if ( !b )
Expand Down

0 comments on commit 2b14c46

Please sign in to comment.