[PySide] QThread crash before emitting finished signal
william.dias at gmail.com
Thu Jun 7 09:59:56 CEST 2012
I have a subclass of QThread which uploads pictures to a webserver. For
each new picture created in the main thread, the program spawns a new
thread to handle the job. I've override the __init__ method to be able to
pass some parameters to the thread object, as you can see bellow.
> photoStatus = Signal(str, str)
def __init__(self, tags, filename, parent=None):
> QThread.__init__(self, parent)
> self.tags = tags
> self.filename = filename
> status = sendPhoto(self.tags, self.filename)
> self.photoStatus.emit(self.filename, status)
In the GUI thread, the method responsible dor creating the threads is the
> photoConnection = PhotoConnection(self.tags_to_string, self.filename, self)
In the PhotoConnection, if I don't set the parent of my Qthread object to
self (for example, if I set to None) or if I don't override the __init__
method and create another method to pass the arguments, when the thread
finishes the execution I got a segfault.
Why is this happening? Can you help me?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the PySide