[PyKDE] Possible PyQt bug?? (simple test file attached)
Phil Thompson
phil at riverbankcomputing.co.uk
Sun Aug 28 12:46:54 BST 2005
On Friday 26 August 2005 11:19 pm, Huaicai Mo wrote:
> Hello,
>
>
>
> For the list of QFileInfo objects returned by entryInfoList(), if I pass
> the object instead of its file name (a string) to a receiver. Later, if I
> try to get its file name from the object through the receiver, Python will
> crash. On the other hand, if I pass its file name to the receiver, then
> there is no problem. My guess is that the list of QFileInfo objects has
> been destroyed even though other object still refers to them.
>
>
>
> The test code is modified from the "Directory Browser" example code coming
> with PyQt. You can test the above 2 cases by changing line 47(marked in
> code) into:
>
> passByName = 0
>
> or
>
> passByName = 1
>
>
>
> Use your mouse to select any file in the browser window. If you use
> "passByName=0", the program will crash, otherwise, it will print the file
> name that you selected.
>
>
>
> BTW, I'm using Python 2.3.4, Qt 3.3.3, PyQt 3.12
This is a bug in your script. The returned QFileInfoList is documented as
being temporary so you need to make a copy of any QFileInfo instance you want
to keep.
Phil
More information about the PyQt
mailing list