Bug report #7228

Incorrect return on boundingbox one-liner

Added by dr - over 11 years ago. Updated about 11 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Python plugins
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:duplicate
Crashes QGIS or corrupts data:Yes Copied to github as #:16259

Description

  • Open vector layer;
  • Select any features;
  • Run python console and try to perfom the following command:
    >>>geom = qgis.utils.iface.activeLayer().selectedFeatures()[0].geometry()
    >>>geom.boundingBox().asPolygon()

Sometimes QGIS crashes but sometimes returns strange result PyQt4.QtCore.QString(u'0.00000000 0.00000000, 0.00000000 0.00000000, 0.00000000 0.00000000, 0.00000000 0.00000000, 0.00000000 0.00000000')


Related issues

Duplicates QGIS Application - Bug report #777: crashes with python reference to destroyed objects (e.g e... Closed

History

#1 Updated by Giovanni Manghi over 11 years ago

  • Status changed from Open to Feedback

is this a regression since 1.8?

#2 Updated by Salvatore Larosa over 11 years ago

it seems related to #777, although I don't get any crash !

This workaround avoid the problem;

ft = iface.activeLayer().selectedFeatures()
ft[0].geometry().boundingBox().asPolygon()

No regression here !

#3 Updated by dr - over 11 years ago

Salvatore Larosa wrote:

This workaround avoid the problem;

Known workaround. But it is not clear why one-line approach doesn't work.

#4 Updated by Salvatore Larosa over 11 years ago

dr - wrote:

Known workaround. But it is not clear why one-line approach doesn't work.

I think the comment nr1 of the above issue mentioned could be a reason !

#5 Updated by Matthias Kuhn about 11 years ago

  • Resolution set to duplicate
  • Status changed from Feedback to Closed

Also available in: Atom PDF