[PyKDE] qsqlcursor lifetime for qdatatable

Phil Thompson phil at river-bank.demon.co.uk
Thu Jun 27 16:45:00 BST 2002


Andreas Kloeckner wrote:

> hi all,
> 
>   i just discovered another problem in pyqt, or rather in the
>   cooperation of qt's and pyqt's interface. the qsqlcursor that
>   you pass on to qdatatable's constructor is supposed to be available 
>   throughout the whole lifetime of the qdatatable. if you just create
>   a qsqlcursor locally and pass it to the constructor, you'll soon run
>   into a segfault because the garbage collector has gotten rid of
>   it.
> 
>   i propose that we redefine the semantics of qdatatable in such a way
>   that the table always takes posession of its cursor and frees it
>   itself. (possible by means of setCursor with the autoDelete parameter)
>   i would be willing to provide a patch for this, if there is
>   any demand.


I don't want to do this for the reason that Jim gave, ie. I want PyQt to 
behave as much like Qt as possible (warts and all). The problem occurs 
elsewhere in PyQt, but this is covered by the "Garbage Collection" 
section in the documentation.

Of course, you can't have too much documentation and I'll add a FAQ when 
I get some time.

Phil




More information about the PyQt mailing list