Memory leak in v.11.23

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #37276
    Lasse
    Participant

    Hi,

    I just updated into version 11.23 and now I am getting memory leak if I change a skin at run-time.

    FastMM4 says: “5-12 bytes: TacItemDrawData x 122”

    If I change the skin twice it will be “5-12 bytes: TacItemDrawData x 244”

    With version 11.22 I don't get any leaks. Any idea why?

    #56012
    Lasse
    Participant

    Oh, I see GetExternalSkinNames has changed and is now creating objects which I need to free. Ok, that fixed this.

    #56016
    Support
    Keymaster

    You are right, additional data has been added (ImageIndex).

    I will add a new parameter in the next release: “CreateDataObject: boolean = False”

    This data will not be added if CreateDataObject is False (default value).

    If you have a sources of the package you can replace this function in the sSkinManager.pas right now

    Code:
    function TsSkinManager.GetExternalSkinNames(sl: TacStrings; CreateDataObject: boolean = False; SkinType: TacSkinTypes = stAllSkins): acString;
    var
    stl: TacStringList;
    i: Integer;

    procedure AddItem(const sName: string; sImgIndex: integer);
    var
    iData: TacItemDrawData;
    begin
    if CreateDataObject then begin
    iData := TacItemDrawData.Create;
    iData.ImageIndex := sImgIndex;
    stl.AddObject(sName, iData);
    end
    else
    stl.Add(sName);
    end;

    begin
    Result := '';
    sl.Clear;
    if sl is TStringList then
    stl := TStringList(sl)
    else
    stl := TacStringList.Create;

    for i := 0 to Length(SkinListController.SkinList) – 1 do
    with SkinListController.SkinList do
    if skSkinMode <> smInternal then
    AddItem(skName, skImageIndex);

    if sl.Count > 0 then
    Result := sl[0]
    else
    Result := '';

    stl.Sort;
    if not (sl is TStringList) then begin
    sl.Assign(stl);
    FreeAndNil(stl);
    end;
    end;

    #56018
    HeDiBo
    Participant
    'Support' wrote:

    You are right, additional data has been added (ImageIndex).

    I will add a new parameter in the next release: “CreateDataObject: boolean = False”

    This data will not be added if CreateDataObject is False (default value).

    If you have a sources of the package you can replace this function in the sSkinManager.pas right now

    There's no such thing as a quick fix,

    Your patch is incompatible with the call in acSelectSkin.pas. The two default parameters should be exchanged.

    #56020
    Support
    Keymaster

    You are right, thank you. “False” as second parameter should be added there.

    #56021
    HeDiBo
    Participant
    'Support' wrote:

    You are right, thank you. “False” as second parameter should be added there.

    If you make CreateDataObject the third parameter here, nothing else has to change.

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.