[QGIS-Developer] GPS Stream Plugin Crashing QGIS

Joshua Quesenberry engnfrc at gmail.com
Tue May 9 08:02:31 PDT 2017

Greetings Everyone,


I'm playing around with a plugin that's supposed to receive GPS Data over a
TCP socket and then once a new point is received the Vector Memory/Scratch
Layer has all features removed and a new Point feature added. I have a
worker thread running that processes the incoming TCP socket data (rate of
about 10 Hz) and then runs a function called addPoint. Currently the plugin
works great if I don't call addPoint and just print the contents of the
received message. Once I add in the addPoint function, however, the plugin
works for a bit (30-60 seconds) and then QGIS crashes.


My addPoint function is as follows:


    def addPoint(self, point):


        caps = self.layer.dataProvider().capabilities()

        if caps & QgsVectorDataProvider.DeleteFeatures:

            for feat in self.layer.getFeatures():


        if caps & QgsVectorDataProvider.AddFeatures:

            feat = QgsFeature(self.layer.pendingFields())


            (res, outFeats) = self.layer.dataProvider().addFeatures([feat])



Perhaps the issue is because I'm entering/exiting Edit mode so often (10
Hz)? Is there a more efficient method to accomplish what I'm doing? Or maybe
it's some sort of threading conflict?




Josh Q

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20170509/5edb950a/attachment.html>

More information about the QGIS-Developer mailing list