[PyQt] Keeping references to parent objects

Florian Bruhin me at the-compiler.org
Tue Mar 17 09:17:17 GMT 2015


Hi,

http://stackoverflow.com/a/11945184 says this:

    - A QObject should generally not have a reference to its parent or
      any of its ancestors (weak references are ok). This will cause
      memory leaks at best and occasional crashes as well.

      [...]

    - Objects that reference their parent or any ancestor can cause an
      exit crash.

Is this true? Is there more information about this somewhere?

I usually use signals, but there are some instances where it'd be
useful if an object kept a reference to its parent. Should I use
weakref for that everywhere?

Thanks,

Florian

-- 
http://www.the-compiler.org | me at the-compiler.org (Mail/XMPP)
   GPG: 916E B0C8 FD55 A072 | http://the-compiler.org/pubkey.asc
         I love long mails! | http://email.is-not-s.ms/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20150317/fe8b3a77/attachment.sig>


More information about the PyQt mailing list