Hi Richard

On Wed, Feb 4, 2015 at 11:10 PM, Richard Duivenvoorde <[email protected]>
wrote:

> On 04-02-15 17:07, Richard Duivenvoorde wrote:
>
> > Anybody a clue?
> > Trying to attach gdb to the so libs, but failing.
> >
> > It segfaults at the getFeatures() call, as if something wrong with the
> > iterator..
>
> Ah, the original questioner figured out how to save a backtrace:
>
> http://pastebin.com/MTqWH2UL


Looks like QApplication instance was not created, so all places where
events are needed will fail (e.g. for postgres there is a connection pool
which releases connections after some time). Something like this should be
added to the top:

import sys
app = QApplication(sys.argv)

Also, at the end of a script it is wise to call QgsApplication.exitQgis()
to clean up qgis libraries properly (to avoid crashes on exit). There is a
small help for pythonistas from Nathan - a context manager that hides these
pieces of code. It can be seen in Tim's post:
http://kartoza.com/how-to-load-a-qgis-project-in-python/

Cheers
Martin
_______________________________________________
Qgis-developer mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to