Re: [PyQt] Bug in QTableView.setModel()

2008-01-08 Thread Aaron Digulla
Quoting Aaron Digulla <[EMAIL PROTECTED]>: Another wa would be to save all objects which pass through SIP in map (QObject -> Python wrapper), connect to the destroyed(QObject) signal and check the state when it is emitted. Does SIP notice when the python wrapper is destroyed? If not, it's probab

Re: [PyQt] Bug in QTableView.setModel()

2008-01-08 Thread Aaron Digulla
Quoting Hans-Peter Jansen <[EMAIL PROTECTED]>: First of all, happy new year, Phil & and PyQtnistas! Thanks, to you, too. :) The difference is that in C++ the effect of the bug is a memory leak, but in PyQt it is often a crash. This part is what bugs me, and surely caught every PyQt user in

Re: [PyQt] Bug in QTableView.setModel()

2008-01-08 Thread Hans-Peter Jansen
First of all, happy new year, Phil & and PyQtnistas! Am Dienstag, 8. Januar 2008 schrieb Phil Thompson: > > In C++ you should be managing the lifecycle of the model you create > (either by giving it a parent or by keeping a pointer to it and deleting > it when appropriate). The same applies in PyQ

Re: [PyQt] Bug in QTableView.setModel()

2008-01-08 Thread Brian Kelley
On Jan 8, 2008, at 7:12 AM, Aaron Digulla wrote: Quoting Phil Thompson <[EMAIL PROTECTED]>: I'm happy to consider ways to make this more obvious (even if it's just a better FAQ), but I'm not happy about departing from the Qt API and introducing inconsistencies in fundamental behaviour. Th

Re: [PyQt] Bug in QTableView.setModel()

2008-01-08 Thread Phil Thompson
On Tuesday 08 January 2008, Aaron Digulla wrote: > Quoting Phil Thompson <[EMAIL PROTECTED]>: > > I'm happy to consider ways to make this more obvious (even if it's just a > > better FAQ), but I'm not happy about departing from the Qt API and > > introducing inconsistencies in fundamental behaviour

Re: [PyQt] Bug in QTableView.setModel()

2008-01-08 Thread Aaron Digulla
Quoting Phil Thompson <[EMAIL PROTECTED]>: I'm happy to consider ways to make this more obvious (even if it's just a better FAQ), but I'm not happy about departing from the Qt API and introducing inconsistencies in fundamental behaviour. Then let me put it this way: If I wanted to care about w

Re: [PyQt] Bug in QTableView.setModel()

2008-01-08 Thread Phil Thompson
On Tuesday 08 January 2008, Aaron Digulla wrote: > Quoting Andreas Pakulat <[EMAIL PROTECTED]>: > >> I'm talking about preventing the python class which is used as the model > >> being garbage collected; it doesn't matter from which Qt class it is > >> derived. > >> > >> As it is, the class pointer

Re: [PyQt] Bug in QTableView.setModel()

2008-01-08 Thread Phil Thompson
On Tuesday 08 January 2008, Aaron Digulla wrote: > Quoting Aaron Digulla <[EMAIL PROTECTED]>: > >>> I'm talking about preventing the python class which is used as the > >>> model being garbage collected; it doesn't matter from which Qt class it > >>> is derived. > >>> > >>> As it is, the class poin

Re: [PyQt] Bug in QTableView.setModel()

2008-01-08 Thread Aaron Digulla
Quoting Aaron Digulla <[EMAIL PROTECTED]>: I'm talking about preventing the python class which is used as the model being garbage collected; it doesn't matter from which Qt class it is derived. As it is, the class pointer is copied into the view class and then python frees the memory. That caus

Re: [PyQt] Bug in QTableView.setModel()

2008-01-08 Thread Aaron Digulla
Quoting Andreas Pakulat <[EMAIL PROTECTED]>: I'm talking about preventing the python class which is used as the model being garbage collected; it doesn't matter from which Qt class it is derived. As it is, the class pointer is copied into the view class and then python frees the memory. That ca

Re: [PyQt] Bug in QTableView.setModel()

2008-01-07 Thread Andreas Pakulat
On 07.01.08 11:12:10, Aaron Digulla wrote: > Quoting Andreas Pakulat <[EMAIL PROTECTED]>: > >> On 06.01.08 21:13:44, Aaron Digulla wrote: >>> The root cause is that setModel() doesn't increment the usage counter of >>> the python class passed in, so Python will GC it if I don't save a >>> pointer e

Re: [PyQt] Bug in QTableView.setModel()

2008-01-07 Thread Aaron Digulla
Quoting Andreas Pakulat <[EMAIL PROTECTED]>: On 06.01.08 21:13:44, Aaron Digulla wrote: The root cause is that setModel() doesn't increment the usage counter of the python class passed in, so Python will GC it if I don't save a pointer elsewhere. Thats by purpose. One reason I can think of is

Re: [PyQt] Bug in QTableView.setModel()

2008-01-07 Thread Andreas Pakulat
On 06.01.08 21:13:44, Aaron Digulla wrote: > The root cause is that setModel() doesn't increment the usage counter of > the python class passed in, so Python will GC it if I don't save a > pointer elsewhere. Thats by purpose. One reason I can think of is that you often want to use the model elsewh

[PyQt] Bug in QTableView.setModel()

2008-01-06 Thread Aaron Digulla
Hello, When I create a python implementation of a table model derived from QAbstractTableModel and use that in QTableView.setModel(), I have spurious errors afterwards: Sometimes, the redraw doesn't work, sometimes, I can't select anything, etc. The root cause is that setModel() doesn't increment