Derek Fountain wrote:
> I see from the docs of QLIstItem.takeItem() that "Items removed from
> a list widget will not be managed by Qt, and will need to be deleted
> manually" Is this true for QtJambi, or just a left over bit of
> documentation from the C++ conversion ?
 >
> Can I generally trust the garbage collector to clean up my Qt
> objects, or do I need to encourage it along with "currItem = null;"
> type statements?

In the case of takeItem() the GC will collect the object.

There are some very few cases where garbage collection must be handled 
explicitly, by calling dispose() on the object. The only case I can 
think of is the case covered by QThread, which should hardly ever occur, 
so you shouldn't have to think about it.

You can of course care about GC if you like. For instance:

for (String imageFile : images) {
     QImage image = new QImage(imageFile);
     icons.put(image.scaled(16, 16);
     image.dispose();
}

In this case you can release the native image data directly, thus 
preventing pooling of memory which would otherwise occur. If you do use 
dispose() you should know that the object is not being used elsewhere 
though, because it can sometimes be dangerous...

-
Gunnar
_______________________________________________
Qt-jambi-interest mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-jambi-interest

Reply via email to