> Phil Thompson <[EMAIL PROTECTED]> 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.
But that would be too late wouldn't it? You are still going to get a double free of the object. I think one way around the problem is to avoid the extra reference to the Python object and move the data that it contains into a separate data structure. In other words, weaken the link between the Python world and the C++ world. My concern would then be stopping the new data structure leaking - I need to think about it a bit more. Phil _______________________________________________ PyKDE mailing list PyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde