Fix bug variables in Debug Variable List unregistered even if they still exist in transfered program
authorlaurent
Tue, 21 Feb 2012 23:56:13 +0100
changeset 651 34c1fa1a89a9
parent 650 aaa3b02d42b1
child 652 676307069508
Fix bug variables in Debug Variable List unregistered even if they still exist in transfered program
PLCOpenEditor.py
--- a/PLCOpenEditor.py	Mon Feb 20 15:21:10 2012 +0100
+++ b/PLCOpenEditor.py	Tue Feb 21 23:56:13 2012 +0100
@@ -1947,10 +1947,10 @@
                     root = None
             for idx in idxs:
                 editor = self.TabsOpened.GetPage(idx)
-                item = None
-                if root is not None:
-                    item = self.GetInstancesTreeItem(root, editor.GetInstancePath())
                 if editor.IsDebugging():
+                    item = None
+                    if root is not None:
+                        item = self.GetInstancesTreeItem(root, editor.GetInstancePath())
                     if item is None:
                         self.TabsOpened.DeletePage(idx)
                     elif isinstance(editor, GraphicViewer):
@@ -4126,8 +4126,10 @@
         self.Thaw()
     
     def UnregisterObsoleteData(self):
-        for idx, item in enumerate(self.Table.GetData()):
-            if self.GetDataType(item.GetVariable()) is None:
+        items = [(idx, item) for idx, item in enumerate(self.Table.GetData())]
+        items.reverse()
+        for idx, item in items:
+            if self.GetDataType(item.GetVariable().upper()) is None:
                 self.RemoveDataConsumer(item)
                 self.Table.RemoveItem(idx)
         self.Freeze()