mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-27 13:00:17 +02:00
- fix possible crashes of imagelistcache
git-svn-id: trunk@12920 -
This commit is contained in:
parent
fc8a994cc6
commit
0dd71dc759
@ -181,7 +181,10 @@ begin
|
||||
FListeners.Remove(AListener);
|
||||
end;
|
||||
if FListeners.Count = 0 then
|
||||
begin
|
||||
FImageListCache := nil;
|
||||
Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TImageListCache.RegisterBitmap(AListener: IImageCacheListener; ABitmap: TBitmap; ABitmapCount: Integer = 1);
|
||||
|
@ -31,7 +31,10 @@ end;
|
||||
destructor TButtonGlyph.Destroy;
|
||||
begin
|
||||
if FImagesCache <> nil then
|
||||
begin
|
||||
FImagesCache.UnregisterListener(Self);
|
||||
FImagesCache := nil; // cache can free on unregister
|
||||
end;
|
||||
FOriginal.Free;
|
||||
FOriginal := nil;
|
||||
inherited Destroy;
|
||||
@ -99,7 +102,10 @@ end;
|
||||
procedure TButtonGlyph.GlyphChanged(Sender: TObject);
|
||||
begin
|
||||
if FImagesCache <> nil then
|
||||
begin
|
||||
FImagesCache.UnregisterListener(Self);
|
||||
FImagesCache := nil; // cache can free on unregister
|
||||
end;
|
||||
|
||||
if (FOriginal.Width > 0) and (FOriginal.Height > 0) then
|
||||
begin
|
||||
|
Loading…
Reference in New Issue
Block a user