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:
mcoletti 2004-03-26 22:52:10 +00:00
parent 4f120dc186
commit b5aee9e66e

View File

@ -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;