JPEG Thumbnailer

Thiago Macieira thiago at kde.org
Tue Aug 19 07:44:11 BST 2008


Ingo Klöcker wrote:
>The point of using QFile is that you do not have to take care of the
>file resource yourself. QFile will take care of closing the file. Using
>a class for handling a resource (e.g. QFile for a file, smart pointers
>for objects allocated on the heap, etc.) is always preferable to
>dealing with the resource yourself, because it's so darn easy to leak a
>resource if you do it yourself.

That means you shouldn't use fdopen on the handle returned by QFile.

The handle that QFile returns is closed correctly by QFIle, but if you do 
an fdopen, then you have to remember to fclose.

So, if you need the FILE* anyways, avoid the complexity and open it 
directly.

-- 
  Thiago Macieira  -  thiago (AT) macieira.info - thiago (AT) kde.org
    PGP/GPG: 0x6EF45358; fingerprint:
    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20080819/322b9d21/attachment.sig>


More information about the kde-core-devel mailing list