I have a QMainWindow that launches QThread and waits for data from the network. updates the interface when it receives any data.
the problem is that it sometimes crashes. and sometimes not, all I do is run it and wait for the data.
Here is the stream class:
class ListenerThread(QtCore.QThread):
def __init__(self,host,port,window):
super(ListenerThread,self).__init__(window)
self.host = host
self.port = port
self.window = window
def run(self):
soc = socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
soc.bind((self.host, self.port))
while True:
data, address = soc.recvfrom(9999)
print address
if data:
dataList = data.split("\\")
company = dataList[1]
projectName = dataList[2]
assets = dataList[3]
assetType = dataList[4]
assetName = dataList[5]
self.parent().updateCombo(self.window.comboBoxCompany,company)
self.parent().updateCombo(self.window.dropDownProjects,projectName)
self.parent().select(assets,assetName)
Why is this happening? that the main window itself works great.
the function (updateCombo) works just as well (when you call it from a class).
but the main window continues to crash when sending data! any idea why?
source
share