@@ -268,7 +268,7 @@ bool QgsOgrProvider::getNextFeature(QgsFeature& feature)
268268 feature.setTypeName (featureTypeName);
269269
270270 /* fetch geometry */
271- if (mFetchGeom )
271+ if (mFetchGeom || mUseIntersect )
272272 {
273273 OGRGeometryH geom = OGR_F_GetGeometryRef (fet);
274274
@@ -324,8 +324,7 @@ bool QgsOgrProvider::getNextFeature(QgsFeature& feature)
324324 }
325325}
326326
327- void QgsOgrProvider::select (QgsAttributeList fetchAttributes, QgsRect rect, bool fetchGeometry, \
328- bool useIntersect)
327+ void QgsOgrProvider::select (QgsAttributeList fetchAttributes, QgsRect rect, bool fetchGeometry, bool useIntersect)
329328{
330329 mUseIntersect = useIntersect;
331330 mAttributesToFetch = fetchAttributes;
@@ -339,8 +338,9 @@ void QgsOgrProvider::select(QgsAttributeList fetchAttributes, QgsRect rect, bool
339338 else
340339 {
341340 OGRGeometryH filter = 0 ;
342- QString wktExtent = QString (" POLYGON ((%1))" ).arg (rect.asPolygon ());
343- const char *wktText = wktExtent.toAscii ();
341+ QString wktExtent = QString (" POLYGON((%1))" ).arg (rect.asPolygon ());
342+ QByteArray ba = wktExtent.toAscii ();
343+ const char *wktText= ba;
344344
345345 if (useIntersect)
346346 {
@@ -349,11 +349,10 @@ void QgsOgrProvider::select(QgsAttributeList fetchAttributes, QgsRect rect, bool
349349 if ( mSelectionRectangle )
350350 OGR_G_DestroyGeometry ( mSelectionRectangle );
351351
352- OGR_G_CreateFromWkt ( (char **)&wktText,
353- NULL , & mSelectionRectangle ) ;
352+ OGR_G_CreateFromWkt ( (char **)&wktText, NULL , & mSelectionRectangle );
353+ wktText= ba ;
354354 }
355-
356- wktText = wktExtent.toAscii ();
355+
357356 OGR_G_CreateFromWkt ( (char **)&wktText, NULL , &filter );
358357 QgsDebugMsg (" Setting spatial filter using " + wktExtent);
359358 OGR_L_SetSpatialFilter ( ogrLayer, filter );
0 commit comments