Bläddra i källkod

- when using .keys method (in Python3 is no longer atomic operation) to
make it more resilient to multithreading I've added the more costing
operation of copy().

Marius Stanciu 7 år sedan
förälder
incheckning
4c0884e16d
1 ändrade filer med 3 tillägg och 3 borttagningar
  1. 3 3
      FlatCAMObj.py

+ 3 - 3
FlatCAMObj.py

@@ -729,20 +729,20 @@ class FlatCAMExcellon(FlatCAMObj, Excellon):
                     exc_final.drills.append({"point": point, "tool": drill['tool']})
                 toolsrework=dict()
                 max_numeric_tool=0
-                for toolname in list(exc.tools.keys()):
+                for toolname in list(exc.tools.copy().keys()):
                     numeric_tool=int(toolname)
                     if numeric_tool>max_numeric_tool:
                         max_numeric_tool=numeric_tool
                     toolsrework[exc.tools[toolname]['C']]=toolname
 
                 #exc_final as last because names from final tools will be used
-                for toolname in list(exc_final.tools.keys()):
+                for toolname in list(exc_final.tools.copy().keys()):
                     numeric_tool=int(toolname)
                     if numeric_tool>max_numeric_tool:
                         max_numeric_tool=numeric_tool
                     toolsrework[exc_final.tools[toolname]['C']]=toolname
 
-                for toolvalues in list(toolsrework.keys()):
+                for toolvalues in list(toolsrework.copy().keys()):
                     if toolsrework[toolvalues] in exc_final.tools:
                         if exc_final.tools[toolsrework[toolvalues]]!={"C": toolvalues}:
                             exc_final.tools[str(max_numeric_tool+1)]={"C": toolvalues}