Bug report #3286
Qgis segfaults instanciating QgsComposition from python
Status: | Closed | ||
---|---|---|---|
Priority: | Low | ||
Assignee: | Marco Hugentobler | ||
Category: | Python plugins | ||
Affected QGIS version: | Regression?: | No | |
Operating System: | Linux | Easy fix?: | No |
Pull Request or Patch supplied: | Resolution: | invalid | |
Crashes QGIS or corrupts data: | Copied to github as #: | 13346 |
Description
crashes immediately after:
composition = core.QgsComposition(render)
Tested with trunk, 1.5 and 1.6
History
#1 Updated by Marco Hugentobler almost 14 years ago
Hm, it does not crash for me here when repeating the steps.
Could you try to replace line 30 in qgscomposition.sip with the following:
QgsComposition( QgsMapRenderer* mapRenderer /TransferThis/ );
Then please recompile QGIS, repeat your script and report back if it fixed the crash
#2 Updated by Alessandro Pasotti almost 14 years ago
Hi, I tested your patch but it still crashes. BTW I suspect it's a bug in QT and I found a way to make it work, it seems like QGraphicsScene (from which QgsComposition inherits, needs a QApplication instance, so this line needs to be added before the call to QgsComposition constructor.
app = [[QtGui]].QApplication(sys.argv, [[QtGui]].QApplication.Tty)
I thought having called QgsApplication.initQgis would have been enough to have a QApplication instance.
You can probably close this bug.
#3 Updated by Martin Dobias almost 14 years ago
- Resolution set to invalid
- Status changed from Open to Closed
Indeed you have to construct a QApplication instance prior to doing any drawing. Closing the bug...