LCL/ImageList: Fix update of images after reloading. Issue #41386, based on patch by Massimo Magnano.

This commit is contained in:
wp_xyz 2025-02-03 12:45:20 +01:00
parent 1014cd330f
commit 654245a39e
2 changed files with 17 additions and 0 deletions

View File

@ -147,6 +147,7 @@ type
function WSCreateReference(AParams: TCreateParams): PWSReference; override;
class procedure WSRegisterClass; override;
procedure ReferenceDestroying; override;
procedure UpdateReference;
public
destructor Destroy; override;
public

View File

@ -719,6 +719,7 @@ var
Add(bmp, nil);
bmp.Free;
end;
UpdateReference;
end;
procedure DoReadLaz2;
@ -757,6 +758,7 @@ var
Add(bmp, nil);
bmp.Free;
end;
UpdateReference;
end;
procedure DoReadLaz3Header(BStream: TStream);
@ -776,7 +778,10 @@ var
begin
DoReadLaz3Header(AStream);
if FCount > 0 then
begin
DoReadLaz3Data(AStream);
UpdateReference;
end;
end;
procedure DoReadLaz4;
@ -796,6 +801,7 @@ var
I.Position := 0;
D := TDecompressionStream.Create(I);
DoReadLaz3Data(D);
UpdateReference;
finally
I.Free;
D.Free;
@ -862,6 +868,7 @@ var
end;
CreateImagesFromRawImage(IntfImage,NewCount);
UpdateReference;
finally
// clean up
ImgReader.Free;
@ -975,6 +982,15 @@ begin
FImageList.DoDestroyResolutionReference(FWidth, Reference._Handle);
end;
procedure TCustomImageListResolution.UpdateReference;
begin
if HandleAllocated then
begin
DestroyReference;
ReferenceNeeded;
end;
end;
procedure TCustomImageListResolution.StretchDraw(Canvas: TCanvas;
Index: Integer; ARect: TRect; Enabled: Boolean);
var