[Lazarus] TRawImage.PerformEffect: how to properly use this?

Bart bartjunk64 at gmail.com
Thu Jan 19 18:52:26 CET 2012


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?

Bart




More information about the Lazarus mailing list