lcl: don't trigger TBitmap.OnChange while adding it to the imagelist cache.

git-svn-id: trunk@16231 -
This commit is contained in:
paul 2008-08-25 14:29:14 +00:00
parent 7a57600b98
commit b955aded7a

View File

@ -200,7 +200,12 @@ procedure TImageListCache.RegisterBitmap(AListener: IImageCacheListener; ABitmap
var
i, AStart, OldLen: Integer;
Item: PImageCacheItem;
OldOnChange: TNotifyEvent;
begin
OldOnChange := ABitmap.OnChange;
ABitmap.OnChange := nil; // prevent further updates
try
RegisterListener(AListener);
Item := FItems.GetItemForListener(AListener);
if Item = nil then
@ -220,6 +225,9 @@ begin
Item^.FImageIndexes[OldLen + i - AStart] := i;
AListener.CacheSetImageIndex(OldLen + i - AStart, i);
end;
finally
ABitmap.OnChange := OldOnChange;
end;
end;
// cache rebuild
@ -339,3 +347,4 @@ end;
end.