fix releaseDevices

This commit is contained in:
chrys 2017-02-26 15:22:41 +01:00
parent 4075cd78b4
commit 09764feaa8

View File

@ -215,7 +215,15 @@ class driver():
try: try:
self.uDevices[fd].close() self.uDevices[fd].close()
except: except:
pass pass
try:
del(self.iDevices[fd])
except:
pass
try:
del(self.uDevices[fd])
except:
pass
def hasIDevices(self): def hasIDevices(self):
if not self._initialized: if not self._initialized:
return False return False
@ -228,7 +236,8 @@ class driver():
def releaseDevices(self): def releaseDevices(self):
if not self.hasIDevices(): if not self.hasIDevices():
return return
for fd in self.iDevices: devices = self.iDevices.copy()
for fd in devices:
self.removeDevice(fd) self.removeDevice(fd)
self.iDevices.clear() self.iDevices.clear()
self.uDevices.clear() self.uDevices.clear()