Forum > FPC development

Bug SysUtils.FindClose in Windows ?

(1/1)

bonmario:
Hi,
sorry for my bad english.
I'm using fpc 3.0.4.

See this code:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TestFindFirst(WrkDir:String);var PathInfo: TSearchRec;begin  SysUtils.FindFirst(AppendPathDelim(WrkDir) + GetAllFilesMask, faDirectory, PathInfo);  SysUtils.FindClose(PathInfo);  {$IFDEF MSWINDOWS}    if (PathInfo.FindHandle <> -1) then begin  {$ENDIF}  {$IFDEF Linux}    if (PathInfo.FindHandle <> nil) then begin  {$ENDIF}      ShowMessage('Error !!!');    end else begin      ShowMessage('Ok ');    end;   Halt;end; 
On Linux, using TestFindFirst, passing an existing directory, the value of "PathInfo.FindHandle" is nil.
On Windows, using TestFindFirst, passing an existing directory, the value of "PathInfo.FindHandle" that i expecting is -1, but result is the same value that it had before the call of "FindClose".

It's a bug?

Thanks in advance, Mario

Jonas Maebe:
The values of TSearchRec are undefined after FindClose. You should not use any of them afterwards.

bonmario:
Sorry, I'm just trying to understand the reason for a problem reported here:

https://forum.lazarus.freepascal.org/index.php/topic,41345.msg286830/topicseen.html#new

Sorry, but I thought I canceled this thread.

Hi, Mario

Navigation

[0] Message Index

Go to full version