[PyKDE] Re: Memory leak & segfault with deleteLater

Giovanni Bajo rasky at develer.com
Mon Jun 20 22:01:02 BST 2005


Phil Thompson <phil at riverbankcomputing.co.uk> wrote:

> I'm not sure if anything can be done to detect and/or prevent the problem.
> It would be easy enough to contrive the same problem in C++, so I don't
> really see it as a PyQt problem. I'm open to suggestions.

What about adding adding a flag (static variable in the derived destructor)
which records if we are already destroying the object? So that, if the
derived destructor gets re-invoked as part of a reference cycle, it just
silently exits without doing anything. I think you have a similar variable,
which records if the C++-side of the object is destroyed or not... maybe you
could set that at the very start of the derived destructor.

>> The second problem is a memory leak:
>
> I'll think about this tomorrow - my head hurts at the moment.

Sure :)
-- 
Giovanni Bajo




More information about the PyQt mailing list