Opened 13 years ago
Closed 13 years ago
#3286 closed bug (invalid)
Qgis segfaults instanciating QgsComposition from python
Reported by: | elpaso | Owned by: | mhugent |
---|---|---|---|
Priority: | critical: causes crash or data corruption | Milestone: | Version 1.7.0 |
Component: | Python plugins and bindings | Version: | Trunk |
Keywords: | QgsComposition | Cc: | cavallini@… |
Must Fix for Release: | No | Platform: | Linux |
Platform Version: | ubuntu lucid 64bit | Awaiting user input: | no |
Description
Attachments (2)
Change History (6)
by , 13 years ago
Attachment: | qgis_crash.py added |
---|
comment:1 by , 13 years ago
Owner: | changed from | to
---|
comment:2 by , 13 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
comment:3 by , 13 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.
comment:4 by , 13 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
Indeed you have to construct a QApplication instance prior to doing any drawing. Closing the bug...
Test script