[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyKDE] Issue with QDialog and lifetime
From:       "Giovanni Bajo" <rasky () develer ! com>
Date:       2005-07-07 13:14:25
Message-ID: 02dc01c582f5$cc7f4b60$bf03030a () trilan
[Download RAW message or body]

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

> 1. Either add an optional parameter to exec_loop() which does the transfer
> or have exec_loop_and_transfer() (or something less of a mouthful). At
> least that way it won't break existing code.

I like this solution. Then I can do:

class QDialog(QDialog):
    exec_loop = QDialog.exec_loop_and_transfer
sys.modules["qt"].__dict__("QDialog") = QDialog


> Either way, I don't think it can be done (to my satisfaction)
> transparently. The programmer is going to have to be aware of the issue
> and explicitly deal with it.


For the backward compatibility issue, PyQt4 looks like a good point of
change. I can't help though with the consistency issue you raised:
consistency is in fact important, but non-leaking code is important too. I
suggest you sacrifice a little consistency in PyQt4 and make this the
default behaviour, together with a exec_loop_and_not_transfer() (or
exec_loop(False)).

I believe however is trained enough to understand the lifetime issues in
PyQt can also cope with QDialog's exec_loop transferring ownership by
default. Instead, those who do not master the lifetime issues will just have
their code working with no leaks without thinking of this.
-- 
Giovanni Bajo

_______________________________________________
PyKDE mailing list    PyKDE@mats.imk.fraunhofer.de
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic