[Lazarus] TRawImage.PerformEffect: how to properly use this?
Mattias Gaertner
nc-gaertnma at netcologne.de
Thu Jan 19 22:25:38 CET 2012
On Thu, 19 Jan 2012 18:52:26 +0100
Bart <bartjunk64 at gmail.com> wrote:
> Hi,
>
> What is the correct way to use TRawImage.PerformEffect?
> Simply doing:
> Image1.Picture.Bitmap.RawImage.PerformEffect(someeffect)
> will lead to memory loss, due to a getmem() call in PerformEffect.
>
> Without looking at the context I tried freeing the memory allocated by
> getmem by using freemem inside the PerformEffect method.
> (You can see this "fix" in the attached patch in
> http://bugs.freepascal.org/view.php?id=21068 )
>
> Now Image1.Picture.Bitmap.RawImage.PerformEffect(someeffect) doesn't
> leak memory anymore, but after rebuilding Lazarus the IDE crashes (at
> least on Win7).
> Undoing my "fix" and rebuilding Lazarus with -gh shows that Lazarus
> does not leak memory, even after numerous calls to
> TRawImage.PerformEffect (made by TImageList).
>
> So either this simple
> Image1.Picture.Bitmap.RawImage.PerformEffect(someeffect) is plain
> wrong usage, or TImageList does something special to avoid this memory
> leak? (I looked at the sources of TImageList but I'm obviously not
> clever enough to see the solution.)
>
> Can someone shed some light on this?
TCustomImageList frees the memory itself.
I added an option, so you can choose to free the memory.
Mattias
More information about the Lazarus
mailing list