<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link="#0563C1" vlink="#954F72"><div class=WordSection1><p class=MsoNormal>Greetings Everyone,<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>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.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>My addPoint function is as follows:<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>    def addPoint(self, point):<o:p></o:p></p><p class=MsoNormal>        self.layer.startEditing()<o:p></o:p></p><p class=MsoNormal>        caps = self.layer.dataProvider().capabilities()<o:p></o:p></p><p class=MsoNormal>        if caps & QgsVectorDataProvider.DeleteFeatures:<o:p></o:p></p><p class=MsoNormal>            for feat in self.layer.getFeatures():<o:p></o:p></p><p class=MsoNormal>                self.layer.deleteFeature(feat.id())<o:p></o:p></p><p class=MsoNormal>        if caps & QgsVectorDataProvider.AddFeatures:<o:p></o:p></p><p class=MsoNormal>            feat = QgsFeature(self.layer.pendingFields())<o:p></o:p></p><p class=MsoNormal>            feat.setGeometry(QgsGeometry.fromPoint(point))<o:p></o:p></p><p class=MsoNormal>            (res, outFeats) = self.layer.dataProvider().addFeatures([feat])<o:p></o:p></p><p class=MsoNormal>        self.layer.commitChanges()<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>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?<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Thanks,<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Josh Q<o:p></o:p></p></div></body></html>