Deleting the layer works around the crash. I feel somewhat silly for not trying such a simple solution :). Instead I tried removing the layer from the map registry before closing, but it still segfaulted. Thanks for the help!
Though it works without crashing now, the behavior for spatialite is still different from other data sources. If I connect to a postgis layer, check that it is valid and then call exitQgis(), it doesn't crash. On Sun, May 1, 2016 at 9:22 AM, Martin Dobias <[email protected]> wrote: > Hi Eric > > On Sat, Apr 30, 2016 at 12:06 AM, Eric Goddard <[email protected]> wrote: >> Hello all, >> >> I'm working on a sync script for use with IntraMaps Roam for offline >> editing. My QGIS version is 2.14.1 (Tested on Fedora 23, Ubuntu 14.04, >> and Windows 7 x64). I'm using a standalone pyqgis script that creates >> the connection to the postgis data source and the spatialite >> datasource that roam uses locally. At this step I've just checked that >> each layer is valid, which they are, but after calling the exitQgis() >> method at the end of the script I get a segmentation fault. I think it >> is related to https://github.com/qgis/QGIS/pull/2944, but that >> specifically says for invalid layers. >> >> [...] >> >> sp_layer = QgsVectorLayer(sp_uri.uri(), "Disconnected Layer", "spatialite") >> >> print sp_layer.isValid() # Prints True >> >> qgs.exitQgis() # segfault :( > > I think you need to delete "sp_layer" before calling exitQgis(). The > call to exitQgis() will invalidate the whole QGIS environment, so > later when sp_layer is auto-deleted by Python at the end of the > script, that will cause segfault. So simply try to add "del sp_layer" > line before exitQgis() > > Cheers > Martin _______________________________________________ Qgis-developer mailing list [email protected] List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer
