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

List:       pykde
Subject:    Re: [PyKDE] Possible PyQt  bug?? (simple test file attached)
From:       Phil Thompson <phil () riverbankcomputing ! co ! uk>
Date:       2005-08-28 11:46:54
Message-ID: 200508281246.54265.phil () riverbankcomputing ! co ! uk
[Download RAW message or body]

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

_______________________________________________
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