EResourceReaderEOSReachedException ?
Original Reporter info from Mantis: Selzig HEM
-
Reporter name:
Original Reporter info from Mantis: Selzig HEM
- Reporter name:
Description:
Hello :
Question in Lazarus BugTracker :
Bug in this little component that returns TVersionResource of a project from its file .res. With 0.9.29 versions and FPC >=2.4.0 , when F9 running, the line ARes.LoadFromFile(AFileName,Reader) returns an EReadError message (Stream read Error), but you can continue to run an all properties are available. (See attachment).
Answer of a Lazarus developer :
Actually this problem is not fixable in Lazarus since it is the way how the resource reader reads the resources (which is part of FPC):
procedure TResResourceReader.Load(aResources: TResources; aStream: TStream);
begin
try
while true do
begin
aRes:=ReadResourceHeader(aStream);
...
end;
except
on e : EResourceReaderEOSReachedException do ;
end;
end;
Note the "while true" loop and exit by exception.
I agree that exception is not the preferrable way for loop exiting.
Anyway, there are 2 solutions:
- add EResourceReaderEOSReachedException to the exceptions to skip in the Lazarus IDE
- move this issue (or create a new one) to the FPC project to let FPC development team to change the design of code (replace exception by something else).
So, option 2...
Best regards. Gilles
Mantis conversion info:
- Mantis ID: 17044
- OS: Windows-Linux
- OS Build: XP-Ubuntu 10.04
- Build: All
- Platform: [FPC] IDE
- Version: 2.4.3
- Fixed in version: 2.6.0
- Fixed in revision: 17756 (#4d3e5128)
- Target version: 2.6.0