
Thread
2011.05.05 16:02 "Re: [Tiff] Access Violation on TiffClose()", by Katerina Sedivy
Ok I was checking the return of TiffOpen at debug mode with a watch, but I still ran the test here is something weird:
This does NOT work: Access violation
var
l_Tiff: pointer;
begin
l_Tiff := DLL_TIFFOpen(PChar('C:\Develop\Tests\Service
app\Thread3\cheque_216_A.tif'), 'r');
try
finally
if l_Tiff <> nil then
DLL_TIFFClose(l_Tiff);
end;
end;
This WORKS and still executes TIFFClose:
var
l_Tiff: pointer;
begin
l_Tiff := DLL_TIFFOpen(PChar('C:\Develop\Tests\Service
app\Thread3\cheque_216_A.tif'), 'r');
if l_Tiff <> nil then
begin
DLL_TIFFClose(l_Tiff);
outputdebugstring(PChar('pass'));
end;
end;
On Thu, May 5, 2011 at 11:27 AM, Olivier Paquet <olivier.paquet@gmail.com>wrote:
On Thu, May 5, 2011 at 11:03 AM, Katerina Sedivy <sedivyk@gmail.com> wrote:
procedure TMainAppRunnerDlg.btnTIFFOpenClick(Sender: TObject);
varlh_TiffHandle: Pointer;
begin
> > lh_TiffHandle := DLL_TIFFOpen('C:\Develop\Tests\cheque_216_A.tif',
> 'r');
> try
> finally
> DLL_TIFFClose(lh_TiffHandle);
> end;
> end;It looks to me like you don't actually check that TIFFOpen works. TIFFClose will definitely crash on a null handle so that might be your problem.