fixed freeing TReader.Driver

git-svn-id: trunk@5788 -
This commit is contained in:
mattias 2004-08-15 15:05:46 +00:00
parent a6d5670154
commit 32db79433f
2 changed files with 4 additions and 3 deletions

View File

@ -1542,7 +1542,8 @@ initialization
{$IFDEF UseFCLDataModule}
RegisterInitComponentHandler(TComponent,@InitResourceComponent);
{$ENDIF}
// keep this comment, there is parser a bug in fpc 1.0.x
// keep this comment line, there is parser a bug in fpc 1.0.x
finalization
//DebugLn('forms.pp - finalization section');

View File

@ -178,7 +178,7 @@ var
LRSObjectWriterClass: TLRSObjectWriterClass;
function InitLazResourceComponent(Instance: TComponent;
RootAncestor: TClass): Boolean;
RootAncestor: TClass): Boolean;
function CreateLRSReader(s: TStream; var DestroyDriver: boolean): TReader;
function CreateLRSWriter(s: TStream; var DestroyDriver: boolean): TWriter;
@ -1642,7 +1642,7 @@ begin
{$IFDEF NewLRSStreamer}
if Result.Driver.ClassType=LRSObjectReaderClass then exit;
// hack to set a write protected variable.
DestroyDriver:=true;
// DestroyDriver:=true; TReader will free it
Driver:=LRSObjectReaderClass.Create(s,4096);
p:=@Result.Driver;
Result.Driver.Free;