mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-15 21:49:06 +02:00
* Fix bug #35305, lazy instantiation of class alias list. Patch from Ondrej Pokorny
git-svn-id: trunk@41819 -
This commit is contained in:
parent
60606e61ef
commit
e3973e9c4e
@ -2496,7 +2496,7 @@ begin
|
|||||||
FindGlobalComponentList:=nil;
|
FindGlobalComponentList:=nil;
|
||||||
IntConstList := TThreadList.Create;
|
IntConstList := TThreadList.Create;
|
||||||
ClassList := TThreadList.Create;
|
ClassList := TThreadList.Create;
|
||||||
ClassAliasList := TStringList.Create;
|
ClassAliasList := nil;
|
||||||
{ on unix this maps to a simple rw synchornizer }
|
{ on unix this maps to a simple rw synchornizer }
|
||||||
GlobalNameSpace := TMultiReadExclusiveWriteSynchronizer.Create;
|
GlobalNameSpace := TMultiReadExclusiveWriteSynchronizer.Create;
|
||||||
RegisterInitComponentHandler(TComponent,@DefaultInitHandler);
|
RegisterInitComponentHandler(TComponent,@DefaultInitHandler);
|
||||||
|
@ -44,8 +44,12 @@ procedure RegisterClassAlias(AClass: TPersistentClass; const Alias: string);
|
|||||||
var
|
var
|
||||||
I : integer;
|
I : integer;
|
||||||
begin
|
begin
|
||||||
|
I:=-1;
|
||||||
ClassList.LockList;
|
ClassList.LockList;
|
||||||
try
|
try
|
||||||
|
if ClassAliasList=nil then
|
||||||
|
ClassAliasList := TStringList.Create
|
||||||
|
else
|
||||||
i := ClassAliasList.IndexOf(Alias);
|
i := ClassAliasList.IndexOf(Alias);
|
||||||
if I = -1 then
|
if I = -1 then
|
||||||
ClassAliasList.AddObject( Alias, TObject(AClass) );
|
ClassAliasList.AddObject( Alias, TObject(AClass) );
|
||||||
@ -101,12 +105,15 @@ begin
|
|||||||
Result := TPersistentClass(Items[I]);
|
Result := TPersistentClass(Items[I]);
|
||||||
if Result.ClassNameIs(AClassName) then Exit;
|
if Result.ClassNameIs(AClassName) then Exit;
|
||||||
end;
|
end;
|
||||||
|
if Assigned(ClassAliasList) then
|
||||||
|
begin
|
||||||
I := ClassAliasList.Indexof(AClassName);
|
I := ClassAliasList.Indexof(AClassName);
|
||||||
if I >= 0 then //found
|
if I >= 0 then //found
|
||||||
Begin
|
Begin
|
||||||
Result := TPersistentClass(ClassAliasList.Objects[i]);
|
Result := TPersistentClass(ClassAliasList.Objects[i]);
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
Result := nil;
|
Result := nil;
|
||||||
finally
|
finally
|
||||||
ClassList.Unlocklist;
|
ClassList.Unlocklist;
|
||||||
|
Loading…
Reference in New Issue
Block a user