mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
QGuardedPtr can only be used on classes derived from QObject. Since OGRFeature
isn't derived from QObject it was inappropriate to use QGuardedPtr for OGRFeature objects. Fixed to use old fashioned pointer checking and deleting. git-svn-id: http://svn.osgeo.org/qgis/trunk@1106 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
4f120dc186
commit
b5aee9e66e
@ -10,8 +10,6 @@
|
||||
#include <ogr_geometry.h>
|
||||
#include <cpl_error.h>
|
||||
|
||||
#include <qguardedptr.h>
|
||||
|
||||
#include "../../src/qgsdataprovider.h"
|
||||
#include "../../src/qgsfeature.h"
|
||||
#include "../../src/qgsfield.h"
|
||||
@ -118,10 +116,9 @@ QgsFeature * QgsShapeFileProvider::getFirstFeature(bool fetchAttributes)
|
||||
#endif
|
||||
ogrLayer->ResetReading();
|
||||
|
||||
// use QGuardedPtr to insure feat is destroyed no matter how we exit this function
|
||||
QGuardedPtr<OGRFeature> feat = ogrLayer->GetNextFeature();
|
||||
OGRFeature * feat = ogrLayer->GetNextFeature();
|
||||
|
||||
Q_ASSERT( ! feat.isNull() );
|
||||
Q_CHECK_PTR( feat );
|
||||
|
||||
if(feat)
|
||||
{
|
||||
@ -144,6 +141,8 @@ QgsFeature * QgsShapeFileProvider::getFirstFeature(bool fetchAttributes)
|
||||
|
||||
if ( ! f ) // return null if we can't get a new QgsFeature
|
||||
{
|
||||
delete feat;
|
||||
|
||||
return 0x0;
|
||||
}
|
||||
|
||||
@ -153,6 +152,9 @@ QgsFeature * QgsShapeFileProvider::getFirstFeature(bool fetchAttributes)
|
||||
{
|
||||
getFeatureAttributes(feat, f);
|
||||
}
|
||||
|
||||
delete feat;
|
||||
|
||||
}
|
||||
|
||||
return f;
|
||||
|
Loading…
x
Reference in New Issue
Block a user