mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-11 10:59:16 +02:00
- fix hang (on exit) of projects contains listview with assigned more than 1 imagelist (and hang on lazarus itself) (from Nikolay) issue #9609
git-svn-id: trunk@11975 -
This commit is contained in:
parent
7d5f9842ec
commit
8c2198629f
@ -858,12 +858,12 @@ type
|
||||
FListItems: TListItems;
|
||||
FColumns: TListColumns;
|
||||
FImages: array[TListViewImageList] of TCustomImageList;
|
||||
FImageChangeLinks: array[TListViewImageList] of TChangeLink;
|
||||
FFlags: TListViewFlags;
|
||||
|
||||
FViewStyle: TViewStyle;
|
||||
FSortType: TSortType;
|
||||
FSortColumn: Integer;
|
||||
FImageChangeLink : TChangeLink;
|
||||
FScrollBars: TScrollStyle;
|
||||
FViewOriginCache: TPoint; // scrolled originwhile handle is not created
|
||||
FSelected: TListItem; // temp copy of the selected item
|
||||
|
@ -17,6 +17,8 @@
|
||||
TCustomListView Constructor
|
||||
------------------------------------------------------------------------------}
|
||||
constructor TCustomListView.Create(AOwner: TComponent);
|
||||
var
|
||||
lvil: TListViewImageList;
|
||||
begin
|
||||
inherited Create(AOwner);
|
||||
ControlStyle := ControlStyle - [csCaptureMouse];
|
||||
@ -28,8 +30,11 @@ begin
|
||||
FViewStyle := vsList;
|
||||
FSortType := stNone;
|
||||
|
||||
FImageChangeLink := TChangeLink.Create;
|
||||
FImageChangeLink.OnChange := @ImageChanged;
|
||||
for lvil := Low(TListViewImageList) to High(TListViewImageList) do
|
||||
begin
|
||||
FImageChangeLinks[lvil] := TChangeLink.Create;
|
||||
FImageChangeLinks[lvil].OnChange := @ImageChanged;
|
||||
end;
|
||||
FHoverTime := -1;
|
||||
TabStop := true;
|
||||
SetInitialBounds(0,0,100,90);
|
||||
@ -530,13 +535,16 @@ end;
|
||||
{ TCustomListView Destructor }
|
||||
{------------------------------------------------------------------------------}
|
||||
destructor TCustomListView.Destroy;
|
||||
var
|
||||
lvil: TListViewImageList;
|
||||
begin
|
||||
// Better destroy the wincontrol (=widget) first. So wo don't have to delete
|
||||
// all items/columns and we won't get notifications for each.
|
||||
FreeAndNil(FCanvas);
|
||||
inherited Destroy;
|
||||
FreeAndNil(FColumns);
|
||||
FreeAndNil(FImageChangeLink);
|
||||
for lvil := Low(TListViewImageList) to High(TListViewImageList) do
|
||||
FreeAndNil(FImageChangeLinks[lvil]);
|
||||
FreeAndNil(FListItems);
|
||||
end;
|
||||
|
||||
@ -780,13 +788,13 @@ begin
|
||||
if FImages[lvil] = AValue then Exit;
|
||||
|
||||
if FImages[lvil] <> nil
|
||||
then FImages[lvil].UnregisterChanges(FImageChangeLink);
|
||||
then FImages[lvil].UnregisterChanges(FImageChangeLinks[lvil]);
|
||||
|
||||
FImages[lvil] := AValue;
|
||||
|
||||
if FImages[lvil] <> nil
|
||||
then begin
|
||||
FImages[lvil].RegisterChanges(FImageChangeLink);
|
||||
FImages[lvil].RegisterChanges(FImageChangeLinks[lvil]);
|
||||
FImages[lvil].FreeNotification(self);
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user