Newsgroups : Borland : borland.public.delphi.rtl.win32 : 2005 Oct : TCustomVariantType and Runtime Package
| Subject: | TCustomVariantType and Runtime Package |
| Posted by: | "ÍõÐлª" (mustapha.wa..@163.com) |
| Date: | Tue, 18 Oct 2005 10:49:34 |
Create a new project and compile it use runtime packages,run.....
procedure TForm1.Button1Click(Sender: TObject);
var
H:THandle;
begin
Stop:=false;
while not Stop do
begin
H:=LoadPackage('dbrtl70.bpl');
UnLoadpackage(H);
Application.ProcessMessages;
Sleep(10);
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Stop:=true;
end;
After a while,you can see a exception:'Too many custom variant types have
been registered'!
This bug is in Variants.pas:
constructor TCustomVariantType.Create;
begin
Create(LNextVarType);
Inc(LNextVarType);
end;
Each time a CustomVariantType creation,LNextVarType increase one,and don`t
decrease in destroy.
destructor TCustomVariantType.Destroy;
begin
EnterCriticalSection(LVarTypeSync);
try
if FVarType <> 0 then
LVarTypes[VarType - CMinVarType] := CInvalidCustomVariantType;
finally
LeaveCriticalSection(LVarTypeSync);
end;
inherited;
end;
The bug exists so long time,why Borland don`t think to resolve for us?