AWARE [SYSTEMS] Imaging expertise for the Delphi developer
AWare Systems, Imaging expertise for the Delphi developer, Home TIFF and LibTiff Mailing List Archive

LibTiff Mailing List

TIFF and LibTiff Mailing List Archive
November 2000

Previous Thread
Next Thread

Previous by Thread
Next by Thread

Previous by Date
Next by Date

Contact

The TIFF Mailing List Homepage
This list is run by Frank Warmerdam
Archive maintained by AWare Systems



Valid HTML 4.01!



Thread

2000.11.07 19:59 "Win32 not properly closing files", by Peter Montgomery
2000.11.08 15:56 "Re: Win32 not properly closing files", by Bruno Ledoux
2000.11.08 18:09 "Re: Win32 not properly closing files", by <wrmichael@aol.com>
2000.11.09 18:30 "Re: Win32 not properly closing files", by Peter Montgomery

2000.11.09 18:30 "Re: Win32 not properly closing files", by Peter Montgomery

Mea culpa!  Yes, the bug is in my code after all.  Here's the code
snippet that wasn't working...

Tif = TIFFOpen(FileInfo->FullFileName, "r");

if (Tif){
  TIFFClose(Tif);
  Tif = NULL;
}


Seems pretty simple, right?  Really nothing to go wrong here.  However,
I forgot that this application I wrote does a separate file open/read
the header and get info/file close in a totally separate function that
other parts of the code can (and do) call.  Thus, even though the code
here was perfect, it turns out that the code in the "read the header and
get info" function wasn't using TIFFClose() but using the normal
fclose() function.  In this particular case, the error was being
suppressed (since fclose() was trying to close a NULL file handle) and I
didn't know that I had a wee bug in my code.

Sorry to have pestered the list with a question that ultimately
pointed to a bug in my code, but frankly the suggestions on this list
(particularly Ledoux's suggestion to use "ru" instead of "r") enabled me
to find my bug.

    Thanks,
    PeterM