[PyQt] Re: question about cyclic references with QThread

Darren Dale dsdale24 at gmail.com
Fri Mar 27 14:34:43 GMT 2009


On Fri, Mar 27, 2009 at 10:14 AM, Darren Dale <dsdale24 at gmail.com> wrote:

> I have a simple question about QThread. The attached simple example
> illustrates a case where I have a widget that creates and holds a reference
> to a thread, setting itself as the parent. I need the parent to hold a
> reference to the thread, so I can interrupt its execution for example. I
> want to delete the thread when it finishes executing.
>
> What the script demonstrates is that when the widget catches the thread's
> finished signal and deletes its reference to the thread, the thread
> continues to persist until the widget itself goes out of scope. Is this due
> to a cyclic reference? Can anyone suggest what I have done wrong, how I can
> improve it?
>
>
I see my mistake. the thread's parent be None instead of the widget.

Darren
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20090327/605355d6/attachment.html


More information about the PyQt mailing list