File tree Expand file tree Collapse file tree 2 files changed +14
-8
lines changed Expand file tree Collapse file tree 2 files changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -201,12 +201,15 @@ Wrapper for iterator of features from vector data provider or vector layer
201
201
202
202
SIP_PYOBJECT __next__();
203
203
%MethodCode
204
- QgsFeature *f = new QgsFeature;
205
- if ( sipCpp->nextFeature( *f ) )
206
- sipRes = sipConvertFromType( f, sipType_QgsFeature, Py_None );
204
+ std::unique_ptr< QgsFeature > f = qgis::make_unique< QgsFeature >();
205
+ bool result = false;
206
+ Py_BEGIN_ALLOW_THREADS
207
+ result = ( sipCpp->nextFeature( *f ) );
208
+ Py_END_ALLOW_THREADS
209
+ if ( result )
210
+ sipRes = sipConvertFromType( f.release(), sipType_QgsFeature, Py_None );
207
211
else
208
212
{
209
- delete f;
210
213
PyErr_SetString( PyExc_StopIteration, "" );
211
214
}
212
215
%End
Original file line number Diff line number Diff line change @@ -276,12 +276,15 @@ class CORE_EXPORT QgsFeatureIterator
276
276
277
277
SIP_PYOBJECT __next__ ();
278
278
% MethodCode
279
- QgsFeature *f = new QgsFeature;
280
- if ( sipCpp->nextFeature ( *f ) )
281
- sipRes = sipConvertFromType( f, sipType_QgsFeature, Py_None );
279
+ std::unique_ptr< QgsFeature > f = qgis::make_unique< QgsFeature >();
280
+ bool result = false ;
281
+ Py_BEGIN_ALLOW_THREADS
282
+ result = ( sipCpp->nextFeature ( *f ) );
283
+ Py_END_ALLOW_THREADS
284
+ if ( result )
285
+ sipRes = sipConvertFromType( f.release(), sipType_QgsFeature, Py_None );
282
286
else
283
287
{
284
- delete f;
285
288
PyErr_SetString ( PyExc_StopIteration, " " );
286
289
}
287
290
% End
You can’t perform that action at this time.
0 commit comments