PDA

View Full Version : [PyQt4] Segmentation fault on Qthread



thiago.fabre
30th April 2014, 17:00
My systray app, sometimes, crash when a thread is started.
The error is: Segmentation fault (core dumped)

Worker:
class ServerFinder(QtCore.QObject):

server_founded = QtCore.pyqtSignal(str, str)
no_server_founded = QtCore.pyqtSignal()
finished = QtCore.pyqtSignal()

@QtCore.pyqtSlot()
def execute(self):
"""Worker"""
print 'run()'
service = discod_api.ServerDisco()
#result = service.new_query("updrive-request")
result = service.new_query("updrive-request-fabre")
if result is None:
self.no_server_founded.emit()
else:
self.ip = str(result[0])
self.port = str(result[1])
self.server_founded.emit(self.ip, self.port)
self.finished.emit()
print 'end - run()'


Code that starts thread:

self.finder = ServerFinder()
self.finder.moveToThread(self.obj_thread)
self.finder.server_founded.connect(self.server_fou nd)
self.finder.no_server_founded.connect(self.no_serv er_found)
self.obj_thread.started.connect(self.finder.execut e)
self.finder.finished.connect(self.obj_thread.quit)
#obj_thread.finished.connect(app.exit)
self.obj_thread.start()

ChrisW67
30th April 2014, 22:19
Please edit your post and put the code in
tags.

Tell us why you think this crash has anything to do with the code you presented. Where does the program crash when you run it in the Python debugger etc.