[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: [PyQt] Re: question about cyclic references with QThread
From: Darren Dale <dsdale24 () gmail ! com>
Date: 2009-03-27 14:34:43
Message-ID: a08e5f80903270734s25e7740ah858e2a2e60dfcf1a () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
On Fri, Mar 27, 2009 at 10:14 AM, Darren Dale <dsdale24@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
[Attachment #5 (text/html)]
<div class="gmail_quote">On Fri, Mar 27, 2009 at 10:14 AM, Darren Dale <span \
dir="ltr"><<a href="mailto:dsdale24@gmail.com">dsdale24@gmail.com</a>></span> \
wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, \
204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> 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. <br>
<br>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?<br> \
<br></blockquote><div><br>I see my mistake. the thread's parent be None instead \
of the widget.<br></div></div><br>Darren<br>
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic