Bug report #7250

Crash when layers loaded using a python plugin and diagramRenderer

Added by Angus Carr about 11 years ago. Updated about 11 years ago.

Assignee:Matthias Kuhn
Category:Python plugins
Affected QGIS version:master Regression?:No
Operating System:Linux Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:Yes Copied to github as #:16273


I am writing a plugin that loads three layers from a set of text files. It loads them using code from the cookbook, as amended to match the new API for the QgsFeature and QgsVectorFileWriter. If the files exist, I can load them as old files, and the problem persists...

The code worked reliably until about three weeks ago (using the old API) and runs fine in QGis 1.8 (using the old API), although the python bindings for the diagramRenderer are not present, so it skips it.

One element of the code tries to create a diagramRenderer. This used to work fine, creating the pie charts. I used the code from the diagrams tab in C++ as a template for the calls.

If I comment out the diagramRenderer code, QGIS works normally. If I uncomment it, the diagram does not appear, but I can click the interface and widgets respond. Once I click a few things, or call up the context menu for the layer with the diagramRenderer applied, QGIS crashes.

At the very least, this shouldn't crash QGIS. I'm perfectly happy to have my code fail, but not crash the program...

diagtest.py Magnifier - Code snippet set up for the python console (2.12 KB) Angus Carr, 2013-02-27 08:42 PM


#1 Updated by Giovanni Manghi about 11 years ago

  • Status changed from Open to Feedback

Shouldn't we tag this as blocker as it is a regression? cheers!

#2 Updated by Matthias Kuhn about 11 years ago

  • Priority changed from Normal to Severe/Regression
  • Assignee set to Matthias Kuhn
  • Status changed from Feedback to In Progress

A Blocker as it crashes.
But seems not to be a regression, as the bindings where not even present before.

#3 Updated by Matthias Kuhn about 11 years ago

  • Status changed from In Progress to Feedback

I executed the attached code in the python console on latest master.
The diagrams show up and I could not provoke a crash.
I can open the context menu of the TOC and clicking the items in the diagram tab works as well.

Can you give more information on how to reproduce?

Nevertheless, I can reproduce a crash by running the snippet twice. But that's not the scenario you've encountered?

#4 Updated by Matthias Kuhn about 11 years ago

Problem I described is solved as soon as pull request [1] get accepted.

[1]: https://github.com/qgis/Quantum-GIS/pull/446

#5 Updated by Angus Carr about 11 years ago

  • % Done changed from 0 to 100
  • Status changed from Feedback to Closed

It seems to work in the nightlies. Thanks.

Also available in: Atom PDF