- This topic has 5 replies, 3 voices, and was last updated 7 years, 10 months ago by HeDiBo.
-
AuthorPosts
-
January 7, 2017 at 8:46 pm #37276LasseParticipant
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?
January 7, 2017 at 9:03 pm #56012LasseParticipantOh, I see GetExternalSkinNames has changed and is now creating objects which I need to free. Ok, that fixed this.
January 8, 2017 at 8:06 am #56016SupportKeymasterYou 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;January 8, 2017 at 3:37 pm #56018HeDiBoParticipant'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.
January 8, 2017 at 5:18 pm #56020SupportKeymasterYou are right, thank you. “False” as second parameter should be added there.
January 8, 2017 at 7:01 pm #56021HeDiBoParticipant'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.
-
AuthorPosts
- You must be logged in to reply to this topic.