Memory leak in sComboBoxes.pas

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #59256
    Support
    Keymaster

    Thank you, code will be changed in the nearest release.

    Quote:
    if ColorsHolder = nil then // <= This should be if Assigned(ColorsHolder) then

    Why this line should be changed?

    #59257
    Lasse
    Participant

    There is no reason to free an object if it is already nil (that would be an AV). That causes a part of that memory leak. Another part comes from the string list that is created twice.

    Code:
    if ColorsHolder nil then
    ColorsHolder.Free;

    Would make sense but ColorsHolder = nil does not… I rather use Assigned and not Assigned than nil and = nil…

    #59258
    Support
    Keymaster

    Ahh, really.. My mistake.

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